1.安装nginx

    1. docker run -p 80:80 --name nginx -d nginx:1.10

    2.将nginx容器里的配置拷贝到当前目录

    1. mkdir -p /mydata/nginx
    2. cd /mydata
    3. docker container cp nginx:/etc/nginx .
    4. docker stop nginx
    5. docker rm nginx
    6. mv nginx conf
    7. mkdir nginx
    8. mv conf nginx
    1. docker run -p 80:80 --name nginx \
    2. -v /mydata/nginx/html:/usr/share/nginx/html \
    3. -v /mydata/nginx/logs:/var/log/nginx \
    4. -v /mydata/nginx/conf:/etc/nginx \
    5. -d nginx:1.10

    重启自启动

    1. docker update nginx --restart=always