Docker安装nginx
1. 下载nginx
docker pull nginx
2. 创建nginx宿主机目录
mkdir -p /home/nginx/www /home/nginx/logs /home/nginx/conf
2. 创建临时容器
docker run --name nginx-test -p 8080:80 -d nginx
3. 复制nginx配置文件
docker cp nginx-test:/etc/nginx/nginx.conf /home/nginx/conf/
4. 移除临时nginx容器
docker stop nginx-test
docker rm nginx-test
5. 运行nginx容器
docker run --rm -d -p 80:80 --name nginx -v /home/nginx/www:/usr/share/nginx/html -v /home/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /home/nginx/logs:/var/log/nginx nginx