Docker配置镜像加速(CentOS 7系统)
CentOS的配置方式略微复杂:
(1)先将默认的配置文件(/usr/lib/systemd/system/docker.service
)复制到(/etc/systemd/system/docker.service
)
sudo cp -n /usr/lib/systemd/system/docker.service /etc/systemd/system/docker.service
(2)再将加速器地址添加到配置文件的启动命令中
https://06m45orf.
sudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=https://06m45orf.|g" /etc/systemd/system/docker.servicesudo sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=https://06m45orf.|g" /etc/systemd/system/docker.service
镜像加速地址
https://06m45orf.
获取方式,如:
https://docker.mirrors.
〔推荐〕
sudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=https://docker.mirrors.|g" /etc/systemd/system/docker.servicesudo sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=https://docker.mirrors.|g" /etc/systemd/system/docker.service
(3)重启Docker即可
sudo systemctl daemon-reloadsudo service docker restart
如果觉得《Docker配置镜像加速(CentOS 7系统)》对你有帮助,请点赞、收藏,并留下你的观点哦!