1. 程式人生 > 實用技巧 >docker harbor x509: certificate signed by unknown authority action: push: unauthorized to access repository

docker harbor x509: certificate signed by unknown authority action: push: unauthorized to access repository

問題:

[root@win82 win81.inno.com]# docker push win81.inno.com:443/test/busybox
Using default tag: latest
The push refers to repository [win81.inno.com:443/test/busybox]
Get https://win81.inno.com:443/v2/: x509: certificate signed by unknown authority

解決:

將harbor 的主機crt 放到要push 的主機目錄/etc/pki/ca-trust/source/anchors/
[root@win81 cert]# 
pwd /data/cert [root@win81 cert]# scp -p win81.inno.com.crt win82:/etc/pki/ca-trust/source/anchors/ win81.inno.com.crt 100% 2126 1.0MB/s 00:00 在push 主機上更新 [root@win82 certs]# update-ca-trust

出現另個一個問題

[root@win82 certs]# docker push win81.inno.com:443/test/busybox:latest
The push refers to repository [win81.inno.com:443/test/busybox]
1dad141bdb55: Preparing 
unauthorized: unauthorized to access repository: test/busybox, action: push: unauthorized to access repository: test/busybox, action: push

登入後再試

[root@win82 certs]# docker login win81.inno.com:443
Username: admin
Password: 
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
[root@win82 certs]# docker push win81.inno.com:443/test/busybox:latest
The push refers to repository [win81.inno.com:443/test/busybox]
1dad141bdb55: Pushed 
latest: digest: sha256:99243e861067446c9aed305b5690cccb88658d23af3fde338398f27386ded1be size: 527