# 搜索 Nginx 镜像 root@ALi:~# docker search nginx NAME DESCRIPTION STARS OFFICIAL AUTOMATED nginx Official build of Nginx. 16043 [OK] jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 2104 [OK] richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 819 [OK] jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 301 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… 33 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 bitwarden/nginx The Bitwarden nginx web server acting as a r… 12 flashspys/nginx-static Super Lightweight Nginx Image 11 [OK] mailu/nginx Mailu nginx frontend 10 [OK] webdevops/nginx Nginx container 9 [OK] sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a… 7 [OK] ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 3 [OK] wodby/nginx Generic nginx 1 [OK] # 下载 Nginx 镜像 root@ALi:~# docker pull nginx Using default tag: latest latest: Pulling from library/nginx a2abf6c4d29d: Pull complete a9edb18cadd1: Pull complete 589b7251471a: Pull complete 186b1aaa4aa6: Pull complete b4df32aa5a72: Pull complete a0bcbecc962e: Pull complete Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31 Status: Downloaded newer image for nginx:latest docker.io/library/nginx:latest # 验证 Nginx 镜像是否下载成功 root@ALi:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 605c77e624dd 21 hours ago 141MB mysql latest 3218b38490ce 9 days ago 516MB hello-world latest feb5d9fea6a5 3 months ago 13.3kB centos latest 5d0da3dc9764 3 months ago 231MB # 新建容器并运行 Nginx,同时完成端口映射和命名 root@ALi:~# docker run --name first-Nginx -d -p 3000:80 nginx 12fe23e2bac31ebcce62e4fdfe8ae85108c2afa94a1c47e7ee77f99a0e590dba root@ALi:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 12fe23e2bac3 nginx "/docker-entrypoint.…" 3 seconds ago Up 2 seconds 0.0.0.0:3000->80/tcp first-Nginx # 验证是否正确开启 Nginx, 以下为y root@ALi:~# curl localhost:3000 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>
<p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p> </body> </html>