Docker 添加--insecure-registry 私有镜像仓库
方法一
[root@k8s-master01]# vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry 192.168.61.238
[root@k8s-master01]# systemctl daemon-reload && systemctl restart docker
方法二
[root@k8s-master01]# cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
{
"insecure-registry":["192.168.61.238"]
}
或
[root@k8s-master01]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://0nth4654.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.61.238"]
}
然后重启服务
[root@k8s-master01]# systemctl daemon-reload && systemctl restart docker
方法三
适用一些低版本docker
[root@k8s-master01]# vi /usr/lib/systemd/system/docker.service
#修改
ExecStart=/usr/bin/docker daemon -H fd:// --insecure-registry 192.168.1.110:5000
#重启服务
[root@k8s-master01]# systemctl daemon-reload && systemctl restart docker
登录验证
[root@k8s-master ~]# docker login 192.168.61.238
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
作者:一毛
本博客所有文章仅用于学习、研究和交流目的,欢迎非商业性质转载。
不管遇到了什么烦心事,都不要自己为难自己;无论今天发生多么糟糕的事,都不应该感到悲伤。记住一句话:越努力,越幸运。