centos下Docker安装Nginx服务

1.  查看Docker镜像仓库中Nginx的可用版本。

docker search nginx

2.  拉取最新版的Nginx镜像。

docker pull nginx:latest

3.  查看本地镜像。

docker images

4.  运行容器。

docker run --name nginx-test -p 8080:80 -d nginx

命令参数说明:

  • --name nginx-test:容器名称。
  • -p 8080:80: 端口进行映射,将本地8080端口映射到容器内部的80端口。
  • -d nginx: 设置容器在后台一直运行。

5.  在浏览器地址栏输入http://<IP地址>:8080访问Nginx服务。

posted @ 2018-08-08 00:21  JanWong  阅读(9765)  评论(1编辑  收藏  举报