一、拉取倉庫映象 ->docker pull registry:latest 二、啟動倉庫映象 ->docker run -d -p 5000:5000 --name registry --restart=always -v /opt/registry-var/:/var/lib/registry/ registry:latest 三、標記映象 ->docker tag [映象id:tag] 127.0.0.1:5000/test 四、上傳到私人倉庫 ->docker push 127.0.0.1:5000/test 五、常見問題 通常情況下,在上傳映象到倉庫這一步的時候會報個錯,報錯內容如下: Error response from daemon: invalid registry endpoint https://172.21.28.161:5000/v0/: unable to ping registry endpoint https://172.21.28.161:5000/v0/ v2 ping attempt failed with error: Get https://172.21.28.161:5000/v2/: tls: oversized record received with length 20527 v1 ping attempt failed with error: Get https://172.21.28.161:5000/v1/_ping: tls: oversized record received with length 20527. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 172.21.28.161:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/172.21.28.161:5000/ca.crt 這是因為在docker1.3以後,預設與倉庫訪問的協議是https,而剛才使用的是http,所以需要修改配置以支援http方式訪問。修改/etc/docker/daemon.js檔案,加入"insecure-registries":["10.0.0.92:5000"]屬性