CentOS Docker 环境中安装Nginx.

1、首先查找nginx镜像

[root@node1 ~]# docker search nginx

2、拉取官网的nginx镜像

[root@node1 ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
2a72cbf407d6: Pull complete 
fefa2faca81f: Pull complete 
080aeede8114: Pull complete 
Digest: sha256:c4ee0ecb376636258447e1d8effb56c09c75fe7acf756bf7c13efadf38aa0aca
Status: Downloaded newer image for nginx:latest

3、查看获取到的镜像文件

[root@node1 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              7f70b30f2cc6        7 days ago          109MB
ubuntu              14.04               a35e70164dfb        3 weeks ago         222MB
ubuntu              17.10               1af812152d85        3 weeks ago         98.4MB

4、启动nginx 容器

[root@node1 ~]# docker run --name nginx -d -p 80:80 -v /usr/docker/nginx/html:/usr/share/nginx/html -v /etc/docker/nginx/conf.d:/etc/nginx/conf.d nginx
759d6d37858bcc70867321759df12d2881e6399204f2ba6a4b8b10aaea430da3

5、 启动后nginx 验证

posted @ 2018-08-17 01:31  cearnach  阅读(312)  评论(0编辑  收藏  举报