Docker下部署Nginx

Docker下部署Nginx


文章目录

  • Docker下部署Nginx
  • 前言
  • 一、查询nginx镜像
  • 二、拉取最新镜像
  • 三、查询镜像
  • 四、启动镜像容器
  • 五、检查是否启动成功
  • 总结


前言

此文记录下在Docker下部署Nginx。


提示:以下是本篇文章正文内容,下面案例可供参考

一、查询nginx镜像

输入:

docker search nginx

输出:

NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                             Official build of Nginx.                        16021     [OK]       
jwilder/nginx-proxy               Automated Nginx reverse proxy for docker con…   2103                 [OK]
richarvey/nginx-php-fpm           Container running Nginx + PHP-FPM capable of…   820                  [OK]
jc21/nginx-proxy-manager          Docker container for managing Nginx proxy ho…   297                  
linuxserver/nginx                 An Nginx container, brought to you by LinuxS…   161                  
tiangolo/nginx-rtmp               Docker image with Nginx using the nginx-rtmp…   148                  [OK]
jlesage/nginx-proxy-manager       Docker container for Nginx Proxy Manager        147                  [OK]
alfg/nginx-rtmp                   NGINX, nginx-rtmp-module and FFmpeg from sou…   112                  [OK]
nginxdemos/hello                  NGINX webserver that serves a simple page co…   81                   [OK]
privatebin/nginx-fpm-alpine       PrivateBin running on an Nginx, php-fpm & Al…   61                   [OK]
nginx/nginx-ingress               NGINX and  NGINX Plus Ingress Controllers fo…   59                   
nginxinc/nginx-unprivileged       Unprivileged NGINX Dockerfiles                  56                   
nginxproxy/nginx-proxy            Automated Nginx reverse proxy for docker con…   32                   
staticfloat/nginx-certbot         Opinionated setup for automatic TLS certs lo…   25                   [OK]
nginx/nginx-prometheus-exporter   NGINX Prometheus Exporter for NGINX and NGIN…   22                   
schmunk42/nginx-redirect          A very simple container to redirect HTTP tra…   19                   [OK]
centos/nginx-112-centos7          Platform for running nginx 1.12 or building …   16                   
centos/nginx-18-centos7           Platform for running nginx 1.8 or building n…   13                   
mailu/nginx                       Mailu nginx frontend                            10                   [OK]
sophos/nginx-vts-exporter         Simple server that scrapes Nginx vts stats a…   7                    [OK]
devilbox/nginx-stable             Devilbox's Nginx stable (based on official N…   4                    
ansibleplaybookbundle/nginx-apb   An APB to deploy NGINX                          3                    [OK]
arnau/nginx-gate                  Docker image with Nginx with Lua enabled on …   1                    [OK]
wodby/nginx                       Generic nginx                                   1                    [OK]
centos/nginx-110-centos7          Platform for running nginx 1.10 or building …   0    

二、拉取最新镜像

输入:

docker pull nginx:latest

latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete 
f3409a9a9e73: Pull complete 
9919a6cbae9c: Pull complete 
fc1ce43285d7: Pull complete 
1f01ab499216: Pull complete 
13cfaf79ff6d: Pull complete 
Digest: sha256:366e9f1ddebdb844044c2fafd13b75271a9f620819370f8971220c2b330a9254
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

三、查询镜像

输入:

docker images

输出:

REPOSITORY      TAG       IMAGE ID       CREATED         SIZE
nginx           latest    f6987c8d6ed5   5 days ago      141MB

镜像拉取成功:

四、启动镜像容器

输入:

docker run --name nginx-service -p 81:80 -d nginx

五、检查是否启动成功

输入:

docker ps

输出:

ONTAINER ID   IMAGE           COMMAND                  CREATED         STATUS         PORTS                                                                                                          NAMES
3fb02515180b   nginx           "/docker-entrypoint.…"   7 seconds ago   Up 7 seconds   0.0.0.0:81->80/tcp, :::81->80/tcp                                                                              nginx-service

证明服务已经启动了,然后在云服务器中开启81端口,最后测试是否可以访问。
在这里插入图片描述

Docker下部署Nginx_第1张图片


总结

以上就是在docker对ngnix的简单部署,写的有不足之处还望谅解。

你可能感兴趣的:(nginx,docker,运维)