在其他设备用docker login *.*.*.*
登录Harbor 服务器时,报下面错误:
python@job:/lib/systemd/system$ docker login 192.168.0.19
Username: <username>
Password:
Error response from daemon: Get https://192.168.0.19/v2/: x509: certificate signed by unknown authority
默认时,client 与 Registry 的交互是通过 https 通信的。在 install Registry 时,若未配置任何tls 相关的 key 和 crt 文件,https 访问必然失败。使用 "–insecure-registry "可以指定 client 与 Registry 以 http 的方式进行通信。
修改 /lib/systemd/system/docker.service 文件里的 ExecStart= 行:
ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=192.168.0.19
重载、重启 docker 服务,验证配置是否生效
python@job:/lib/systemd/system$ systemctl daemon-reload
python@job:/lib/systemd/system$ systemctl restart docker
python@job:/lib/systemd/system$ docker info
Containers: 3
Running: 0
Paused: 0
Stopped: 3
Images: 3
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: (expected: 468a545b9edcd5932818eb9de8e72413e616e86e)
runc version: N/A (expected: 69663f0bd4b60df09991c08812a60108003fa340)
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-45-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.767GiB
Name: job
ID: QEFB:RN3P:NDXW:6MGB:DL7Y:URYR:75J5:ODXV:YFAK:ARV3:KXII:QGWO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
192.168.0.19
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
可以看到
Insecure Registries:
192.168.0.19
127.0.0.0/8
然后接登录了:
python@job:/lib/systemd/system$ docker login 192.168.0.19
Username: <username>
Password:
WARNING! Your password will be stored unencrypted in /home/python/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded