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

posted @ 2021-07-04 22:13  一毛丶丶  阅读(18903)  评论(0编辑  收藏  举报