繁体   English   中英

从远程注册表中拉取图像 - docker

[英]pull image from remote registry - docker

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

我点击此链接创建私有注册表,我已成功从本地主机中提取,但我一直试图从远程计算机中提取。

我所做的简短描述

第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

第三步:(对于本地主机)

[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

第四步:

[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

第三步:

[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

但它抛出错误 tls:oversized

我有一些与此问题相关的链接link1link2但它不能解决我的问题

我对此链接有些怀疑

1) 我在那个位置找不到任何 docker 文件 /etc/sysconfig/docker, /etc/default/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'.

请帮助从远程机器获取拉取请求到私有注册表。

按照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它将显示图像存储的位置和更多信息。

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

在最新的 docker 版本中出现unknown flag: --insecure-registry错误,请执行以下操作:

编辑deamon.json文件:

{
    "insecure-registries" : [ "server-ip:5000" ]
}

deamon.json文件可以在以下路径中找到:

Windows: %userprofile%\.docker\daemon.json

Linux: /etc/docker/daemon.json

更新deamon.json文件后重启docker

然后执行以下操作:

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

查看新增的图片信息

http://server-ip:5050/v2/_catalog

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM