docker倉庫登錄及配置insecure-registries的方法
更新時間:2022年07月22日 11:21:29 作者:Alex·G
這篇文章主要介紹了docker倉庫登錄配置insecure-registries的方法,docker客戶端如果配置中添加了insecure-registary配置,就不需要在docker 客戶端配置上對應(yīng)證書,如果不配置要在/etc/docker/certs.d/目錄中添加對應(yīng)證書才能正常登錄,感興趣的朋友跟隨小編一起看看吧
1. 配置/etc/docker/daemon.json
# cat /etc/docker/daemon.json { "registry-mirrors": ["https://0nth4654.mirror.aliyuncs.com"], "insecure-registries": ["harbor.domain.io"] }
2. 配置systemd啟動文件
和方法1配置會有沖突,不可同時配置
[0 root@vps harbor]# cat /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service containerd.service Wants=network-online.target Requires=docker.socket containerd.service [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.sock --insecure-registry harbor.domain.io ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always
docker client insecure-registries配置
- docker客戶端如果配置中添加了insecure-registary配置,就不需要在docker 客戶端配置上對應(yīng)證書
- 如果不配置就需要在/etc/docker/certs.d/目錄中添加對應(yīng)證書才能正常登錄
[0 root@vps harbor.domain.io]# docker login harbor.domain.io Username: admin Password: Error response from daemon: Get https://harbor.domain.io/v2/: x509: certificate signed by unknown authority [1 root@vps harbor.domain.io]# cp /data/secret/certs/harbor.domain.io.crt . [0 root@vps harbor.domain.io]# docker login harbor.domain.io 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 [0 root@vps ~]# cat /root/.docker/config.json { "auths": { "harbor.domain.io": { "auth": "YWRtaW46cm9vdC4xMjM0" } } [0 root@vps harbor.domain.io]# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2021-04-21 15:06:49 CST; 9min ago Docs: https://docs.docker.com Main PID: 32439 (dockerd) Tasks: 39 Memory: 63.4M CGroup: /system.slice/docker.service ├─ 920 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 443 -container-ip 172.18.0.10 -container-port 8443 ├─ 932 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.18.0.10 -container-port 8080 ├─32439 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock └─32646 /usr/bin/docker-proxy -proto tcp -host-ip 127.0.0.1 -host-port 1514 -container-ip 172.18.0.2 -container-port 10514 ...
到此這篇關(guān)于docker倉庫登錄 配置insecure-registries的文章就介紹到這了,更多相關(guān)docker倉庫登錄內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
關(guān)于docker清理Overlay2占用磁盤空間的問題(親測有效)
使用Docker過程中,長時間運行服務(wù)容器,導(dǎo)致不能進行上傳文件等操作,今天通過本文給大家詳細介紹下docker清理Overlay2占用磁盤空間的相關(guān)知識,感興趣的朋友一起看看吧2022-03-03docker-compose搭建etcd集群的實現(xiàn)(三節(jié)點)
本文主要介紹了docker-compose搭建etcd集群的實現(xiàn)(三節(jié)點),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07MacOS使用Docker創(chuàng)建MySQL主從數(shù)據(jù)庫的方法
這篇文章主要介紹了MacOS使用Docker創(chuàng)建MySQL主從數(shù)據(jù)庫,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-12-12Docker快速部署國產(chǎn)達夢數(shù)據(jù)庫的實現(xiàn)示例
本文主要介紹了Docker快速部署國產(chǎn)達夢數(shù)據(jù)庫的實現(xiàn)示例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07