参考配置实例见链接 https://blog.csdn.net/lzqlmy/article/details/102913873
$ docker search nginx ##查找 Docker Hub 上的 nginx 镜像
$ docker pull nginx ## 拉取镜像
docker images nginx ##本地镜像列表里查到 REPOSITORY 为 nginx 的镜像
##使用 NGINX 默认的配置来启动一个 Nginx 容器实例 -d设置容器在在后台一直运行
docker run --name runoob-nginx-test -p 8081:80 -d nginx
$ docker ps
CONTAINER ID IMAGE ... PORTS NAMES
5ed953431f80 nginx ... 0.0.0.0:8081->80/tcp runoob-nginx-test
部署
www: 目录将映射为 nginx 容器配置的虚拟目录。
logs: 目录将映射为 nginx 容器的日志目录。
conf: 目录里的配置文件将映射为 nginx 容器的配置文件。
docker run -d -p 8085:80 --name nginx-mobile-8085 -v /home/roger/nginx/www:/usr/share/nginx/html -v /home/roger/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /home/roger/nginx/conf/mobile/mobile_nginx.conf:/etc/nginx/conf.d/default.conf -v /home/roger/nginx/logs:/var/log/nginx nginx
Tips:相应的文件夹及文件权限附上