知方号

知方号

Docker login Harbor报错解决:Error response from daemon: Get https:..

报错信息:代码语言:javascript复制[root@localhost harbor]# docker login 192.168.2.195Username: adminPassword: Error response from daemon: Get https://192.168.2.195/v2/: dial tcp 192.168.2.195:443: connect: connection refused查看Docker版本:代码语言:javascript复制[root@localhost ~]# docker versionClient: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:27:04 2023 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:25:42 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683停止harbor:

 docker-compose down -v:停止并移除整个project的所有services

代码语言:javascript复制[root@localhost harbor]# docker-compose down -vStopping harbor-jobservice ... doneStopping nginx ... doneStopping harbor-ui ... doneStopping redis ... done查找docker.service所在位置:代码语言:javascript复制[root@localhost harbor]# find / -name docker.service -type f/usr/lib/systemd/system/docker.service修改docker.service配置文件:

 添加 --insecure-registry=192.168.2.195 配置

代码语言:javascript复制[root@localhost harbor]# vim /usr/lib/systemd/system/docker.service[Unit]Documentation=http://docs.docker.io //需修改...[Service]Type=notify# the default is not to use systemd for cgroups because the delegate issues still# exists and systemd currently does not support the cgroup feature set required# for containers run by docker# ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sockExecStart=/usr/bin/dockerd --insecure-registry=192.168.2.195 //重要ExecStartPost=/sbin/iptables -I FORWARD -s 0.0.0.0/0 -j ACCEPT //需修改,根据自己的docker路径跟IP地址进行修改ExecReload=/bin/kill -s HUP $MAINPIDTimeoutSec=0RestartSec=2Restart=always...[Install]WantedBy=multi-user.target重启服务:代码语言:javascript复制[root@localhost harbor]# systemctl daemon-reload[root@localhost harbor]# systemctl restart docker启动harbor:

 docker-compose up -d :构建(容器)并启动(容器)整个project的所有service

代码语言:javascript复制[root@localhost harbor]# docker-compose up -dCreating network "harbor_harbor" with the default driverCreating harbor-log ... doneCreating registry ... doneCreating redis ... doneCreating harbor-db ... doneCreating harbor-adminserver ... doneCreating harbor-ui ... doneCreating nginx ... doneCreating harbor-jobservice ... done查看服务:

 已经包含了 --insecure-registry=192.168.2.195 参数

代码语言:javascript复制[root@localhost harbor]# ps -aux | grep docker...root 40719 1.4 4.8 660304 79992 ? Ssl 01:58 0:14 /usr/bin/dockerd --insecure-registry=192.168.2.195...测试登录:代码语言:javascript复制[root@localhost harbor]# docker login 192.168.2.195Username: adminPassword: WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded //登录成功

 成功登录!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lizi9903@foxmail.com举报,一经查实,本站将立刻删除。