[英]Docker private registry
在虛擬服務器ubuntu 14.04上我安裝了docker,我嘗試將一個映像推送到本地注冊表。 我在Docker博客上遵循了這個指南但是當我嘗試推送圖像時,我有這個輸出:
錯誤:無效的注冊表端點https://xx.xx.xx.xx/v1/ :獲取https://xx.xx.xx.xx/v1/_ping :x509:證書已過期或尚未生效。 如果此私有注冊表僅支持具有未知CA證書的HTTP或HTTPS,請將
--insecure-registry xx.xx.xx.xx
添加到守護程序的參數中。 對於HTTPS,如果您可以訪問注冊表的CA證書,則不需要該標志; 只需將CA證書放在/etc/docker/certs.d/xx.xx.xx.xx/ca.crt即可
我嘗試在/etc/default/docker
文件中添加--insecure-registry xx.xx.xx.xx
並重啟docker service。 Docker無法啟動消息/proc/self/fd/9: 17: /etc/default/docker: --insecure-registry: not found
。
PS:我在docker容器中運行我的注冊表
我遇到了與Ubuntu 12.04和Docker 1.4.1相同的問題。 這是我的解決方案:
$ sudo docker push "[host:ip:v6:addr:ess:is:here]:5000/myImage"
FATA[0002] Error: Invalid registry endpoint https://[host:ip:v6:addr:ess:is:here]:5000/v1/: Get https://[host:ip:v6:addr:ess:is:here]:5000/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry [host:ip:v6:addr:ess:is:here]: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/[host:ip:v6:addr:ess:is:here]:5000/ca.crt
所以,我有一個錯誤。
$ ps axwww | grep /usr/bin/docker
14655 ? Ssl 2:06 /usr/bin/docker -d
14869 pts/0 S+ 0:00 grep /usr/bin/docker
請注意,/ usr / bin / docker沒有額外的參數。
$ echo 'DOCKER_OPTS="--insecure-registry [host:ip:v6:addr:ess:is:here]:5000"' | sudo tee -a /etc/default/docker
DOCKER_OPTS="--insecure-registry [host:ip:v6:addr:ess:is:here]:5000"
$ sudo service docker restart
docker stop/waiting
docker start/running, process 15615
讓我們檢查參數是否出現:
$ ps axwww | grep /usr/bin/docker
15615 ? Ssl 0:00 /usr/bin/docker -d --insecure-registry [host:ip:v6:addr:ess:is:here]:5000
15663 pts/0 S+ 0:00 grep /usr/bin/docker
是的,他們這樣做。 還有一次嘗試:
$ sudo docker push "[host:ip:v6:addr:ess:is:here]:5000/myImage"
The push refers to a repository [[host:ip:v6:addr:ess:is:here]:5000/myImage] (len: 1)
Sending image list
Pushing repository [host:ip:v6:addr:ess:is:here]:5000/myImage (1 tags)
511136ea3c5a: Image successfully pushed
27d47432a69b: Pushing [================================================> ] 189.8 MB/197.2 MB 0
只需運行此docker run -p 5000:5000 -d registry
就會讓你遇到麻煩。
我發現本教程很有幫助: 如何在Ubuntu 14.04上設置私有Docker注冊表
它基本上設置了一個使用nginx的反向代理來訪問私有注冊表。 我有1個帶有注冊表的流浪盒和一個不同的流浪盒從這個注冊表中提取東西。 有用 :)
希望有所幫助
直接在主機上設置docker注冊表非常令人沮喪。 設置本地docker存儲庫的最簡單方法是使用docker-registry docker鏡像。 簡單地執行
docker run -p 5000:5000 -d registry
和docker應該下載官方docker注冊表圖像。 之后,您可以附加到容器並自定義設置。 資料來源: http : //www.devops-insight.com/2014/12/using-private-docker-repository-registry.html
在主持人
1- install docker machin
curl -L https://github.com/docker/machine/releases/download/v0.14.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && \
sudo install /tmp/docker-machine /usr/local/bin/docker-machine
2- Remove any proxy entry in /etc/systemd/system/docker.....
3- Edit the daemon.json file, whose default location is /etc/docker/daemon.json
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
4- Generate crt:
$mkdir -p certs
$openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt
Be sure to use the same name myregistrydomain.com as a CN.
Copy the domain.crt file to /etc/docker/certs.d/myregistrydomain.com:5000/ca.crt on every Docker host. You do not need to restart Docker.
5- pull registry image from docker hub
docker run -p 5000:5000 --name myregistry registry
在客戶端
1- Remove any proxy entry in /etc/systemd/system/docker.....
2- Edit the daemon.json file, whose default location is /etc/docker/daemon.json
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.