DOCKER:无法从我的私人注册表中提取

时间:2015-09-16 12:22:07

标签: docker boot2docker

我不能在自己的注册表中使用docker pull,我有一个类似的系统:

Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.5.1
 Git commit:   0a8c2e3
 Built:        Fri Sep 11 01:46:35 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:10:10 UTC 2015
 OS/Arch:      linux/amd64

我的操作系统是OS X

Darwin MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

,错误信息如下:

docker pull 192.168.5.46:5000/ubuntu:trusty
Error response from daemon: unable to ping registry endpoint https://192.168.5.46:5000/v0/
v2 ping attempt failed with error: Get https://192.168.5.46:5000/v2/: EOF
v1 ping attempt failed with error: Get https://192.168.5.46:5000/v1/_ping: EOF

我使用boot2docker,设置env就像:

env | grep DOCKER
DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=/Users/Sirius/.boot2docker/certs/boot2docker-vm

希望得到你的帮助,谢谢!

2 个答案:

答案 0 :(得分:1)

尝试将DOCKER_OPTS添加到您的环境中,这在Ubuntu OS中运行良好。

DOCKER_OPTS="--insecure-registry 192.168.5.46:5000"

答案 1 :(得分:0)

另一种方法是在客户端安装crt。设置所有者注册表时,在注册表主机上创建密钥/ crt。

mkdir -p certs && openssl req \
-newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \
-x509 -days 365 -out certs/domain.crt

然后在注册表主机上启动一个带有注册表图像和密钥/ crt的容器。

docker run -d -p 5000:5000 --restart=always --name gcregistry \
-v /registry/data:/var/lib/registry \
-v /registry/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
registry:2 

要访问CA,请在客户端上安装crt。您可以从https

中提取
scp certs/domain.crt /etc/docker/certs.d/ghostcloud.cn:5000/ca.crt
restart docker