执行
docker pull nginx
报错:
原因是国外服务,国内慢,配置的加速器不行,只需要修改成网易的:
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"http://hub-mirror.c.163.com"
],
"insecure-registries": []
}
重启docker:
systemctl daemon-reload //重新加载配置
systemctl restart docker
4 部署Nginx
①:创建目录存放后面的东西
mkdir -p ~/nginx/www ~/nginx/logs ~/nginx/conf
//目录在/root/nginx
docker run -d -p 8000:80 --name nginx -v ~/nginx/www:/usr/share/nginx/html -v ~/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v ~/nginx/logs:/var/log/nginx nginx