一、nginx
1、nginx_dockerfile
FROM nginx:1.14 COPY nginx/conf.d /etc/nginx/conf.d WORKDIR /etc/nginx RUN mkdir html log
2、build镜像:xy-nginx:2.0
docker build -f nginx_dockerfile -t xy-nginx:2.0 .
3、run容器:xy-nginx(已确认:不能在运行容器时载入配置文件)
docker run -itd \ -e TZ="Asia/Shanghai" \ --restart=always \ --network host \ -v /root/xy/nginx/conf.d:/etc/nginx/conf.d \ -v /root/xy/nginx/log:/etc/nginx/log \ -v /root/xy/nginx/html:/etc/nginx/html \ --name xy-nginx xy-nginx:2.0 \ /bin/bash
4、进入容器
docker exec -it xy-nginx /bin/bash
5、载入配置文件,注:修改配置文件后,必须先重启xy-nginx,再进入容器重新载入
nginx -c /etc/nginx/conf.d/xy.nginx
6、配置文件:xy.nginx,见pg-0服务器:/root/xy
标签:配置文件,etc,部署,nginx,xy2.0,xy,conf,root From: https://www.cnblogs.com/pearlcity/p/16882508.html