主要讲解通过从docker hub上获取nginx镜像
1:首先查找nginx镜像
[root@localhost docker]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 8026 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 1282 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 526 [OK]
jrcs/letsencrypt-nginx-proxy-companion LetsEncrypt container to use with nginx as... 318 [OK]
kong Open-source Microservice & API Management ... 160 [OK]
webdevops/php-nginx Nginx with PHP-FPM 97 [OK]
kitematic/hello-world-nginx A light-weight nginx container that demons... 95
bitnami/nginx Bitnami nginx Docker Image 44 [OK]
linuxserver/nginx An Nginx container, brought to you by Linu... 33
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 26 [OK]
tobi312/rpi-nginx NGINX on Raspberry Pi / armhf 18 [OK]
wodby/drupal-nginx Nginx for Drupal container image 9 [OK]
blacklabelops/nginx Dockerized Nginx Reverse Proxy Server. 8 [OK]
webdevops/nginx Nginx container 8 [OK]
nginxdemos/nginx-ingress NGINX Ingress Controller for Kubernetes 8
centos/nginx-18-centos7 Platform for running nginx 1.8 or building... 6
nginxdemos/hello NGINX webserver that serves a simple page ... 4 [OK]
1science/nginx Nginx Docker images that include Consul Te... 4 [OK]
pebbletech/nginx-proxy nginx-proxy sets up a container running ng... 2 [OK]
behance/docker-nginx Provides base OS, patches and stable nginx... 2 [OK]
travix/nginx NGinx reverse proxy 1 [OK]
toccoag/openshift-nginx Nginx reverse proxy for Nice running on sa... 1 [OK]
mailu/nginx Mailu nginx frontend 0 [OK]
goodguide/nginx-application-proxy No-configuration Nginx reverse proxy for a... 0 [OK]
ppc64le/nginx Official build of Nginx. 0
[root@localhost docker]#
2:拉取官网的nginx镜像
[root@localhost docker]# docker pull nginx
latest: Pulling from nginx
3b530f2a9c24: Pull complete
409bdabda854: Pull complete
d6d4180fd933: Pull complete
92d462650f4b: Pull complete
ee7b94dfef73: Pull complete
7a2c6f1ea023: Pull complete
01908f5aff63: Pull complete
f2f739b51090: Pull complete
d8e491b2e723: Pull complete
b7dd2c8cb8a8: Pull complete
Digest: sha256:c8db985772160427261dc443e62cab3e07212f7d52a18093d29f561b767bccb2
Status: Downloaded newer image for nginx:latest
[root@localhost docker]#
3: 查看获取到的镜像文件
[root@localhost docker]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
nginx latest b7dd2c8cb8a8 8 days ago 108.6 MB
hello-world latest 690d80202531 3 months ago 1.848 kB
[root@localhost docker]#
4: 启动nginx 容器
[root@localhost ~]# docker run -d -p 8080:80 nginxe899b82a5a9e86045591c23e8a5b6415a4f8dcbb2b704067c008041120bb3251
[root@localhost ~]#
5: 启动后nginx 验证
到此通过docker 安装nginx完成。