在其他設備用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 的方式進行通信。
ExecStart=/usr/bin/dockerd -g /data/docker --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