从远程注册表 - docker拉图像

时间:2016-07-13 11:23:17

标签: docker docker-registry

我已经安装了docker 1.11.2,我正在尝试为我们的办公室制作一个私人注册表。

我按照这个link进行私有注册,我已成功从localhost中取出,但我一直试图从远程计算机中拔出。

简要介绍我的工作

第1步:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

第2步:

[root@raj raj]# docker images
REPOSITORY          TAG                 IMAGE ID                   CREATED             SIZE
hello-world         latest              c54a2cc56cbb        11 days ago         1.848 kB
registry            2                   8ff6a4aae657        4 weeks ago         171.5 MB

第3步:(对于localhost)

[root@raj raj]# docker tag hello-world localhost:5000/hello-world

[root@raj raj]# docker push localhost:5000/hello-world
The push refers to a repository [localhost:5000/hello-world]
a02596fdd012: Pushed 
latest: digest: sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4 size: 524

步骤4:

[root@raj raj]# docker pull localhost:5000/hello-world
Using default tag: latest
latest: Pulling from hello-world

Digest: sha256:a18ed77532f6d6781500db650194e0f9396ba5f05f8b50d4046b294ae5f83aa4
Status: Image is up to date for localhost:5000/hello-world:latest

工作正常

我正在尝试从远程计算机私有注册表中提取图像,所以我更改了第3步,如下所示

第3步:

[root@raj raj]# docker tag hello-world 192.168.1.23:5000/hello-world

[root@raj raj]# docker push 192.168.1.23:5000/hello-world
The push refers to a repository [192.168.1.23:5000/hello-world]
Get https://192.168.1.23:5000/v1/_ping: tls: oversized record received with length 20527

但它会抛出错误:超大

我有一些与此问题相关的链接link1link2,但它无法解决我的问题

我对此链接有一些疑问

1)我在该位置/ etc / sysconfig / docker,/ etc / default / docker中找不到任何docker文件来更改-insecure-registry

2)docker -d --insecure-registry 10.11.12.0:5000(此命令不起作用,它会抛出错误。

[root@raj raj]# docker -d --insecure-registry 192.168.1.23:5000
flag provided but not defined: -d
See 'docker –help'.

请帮助从远程计算机获取拉取请求到私人注册表。

2 个答案:

答案 0 :(得分:5)

按照docker命令的顺序进行私人注册

服务器端

docker daemon --insecure-registry server-ip:5000
docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker tag hello-world server-ip:5000/hello-world
docker push server-ip:5000/hello-world

客户端

docker daemon --insecure-registry server-ip:5000
docker pull server-ip:5000/hello-world

现在您可以从远程存储库中提取/推送,有关注册表的更多详细信息,您可以使用此命令docker inspect registry它将显示图像存储的位置和更多信息。

答案 1 :(得分:0)

更新docker config以添加“--insecure-registry”,通常该文件位于 / etc / default / docker ,如果您使用docker-machine,该文件位于的/ var / lib中/ boot2docker /简档