1.搜索镜像
建议去docker hub去搜索:https://hub.docker.com/
或者直接docker search nginx
[root@iZwz92v9xcjopi734c76bdZ ~]# docker search nginx -f=stars=100
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 16213 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 2112 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 821 [OK]
jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 318
linuxserver/nginx An Nginx container, brought to you by LinuxS… 160
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 151 [OK]
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 151 [OK]
alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou… 115 [OK]
2.拉去镜像
docker pull nginx #默认是最新的
[root@iZwz92v9xcjopi734c76bdZ ~]# 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
3.运行测试
查看images
[root@iZwz92v9xcjopi734c76bdZ ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 4 weeks ago 141MB
运行镜像
[root@iZwz92v9xcjopi734c76bdZ ~]# docker run -d --name ng2 -p 8888:80 nginx
# -d 表示后台运行
# --name 表示给容器命名
# -p 主机端口:容器端口
查看正在运行的镜像
[root@iZwz92v9xcjopi734c76bdZ ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2615c2912e02 nginx "/docker-entrypoint.…" 59 seconds ago Up 59 seconds 0.0.0.0:8888->80/tcp, :::8888->80/tcp ng2
[root@iZwz92v9xcjopi734c76bdZ ~]#
访问
nice!