简体   繁体   English

Docker:无法拉取已推送到私有注册表的映像

[英]Docker: Cannot pull an image that was pushed to a private registry

I do this:我这样做:

docker pull my-private-repo.xyz.com:443/platform/abc docker pull my-private-repo.xyz.com:443/platform/abc

I get following error:我收到以下错误:

Pulling repository my-private-repo.xyz.com:443/platform/abc
Error: Status 400 trying to pull repository platform/abc: "{\n  \"errors\" : [ {\n    \"status\" : 400,\n    \"message\" : \"Unsupported docker v1 repository request for 'my-private-repo'\"\n  } ]\n}"

My docker daemon is configured as this:我的 docker 守护进程配置如下:

{
  "insecure-registries" : [
    "my-private-repo.xyz.com:443"
  ],
  "experimental" : false
}

Here is my docker info:这是我的码头工人信息:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 15
Server Version: 1.13.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 22
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.4-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: WW55:6DVS:DJCJ:3NXI:2CDX:44JW:F6IK:P2JU:LM7X:B76Y:HC3G:RCEU
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 27
 System Time: 2017-01-24T21:30:22.279581628Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 my-private-repo.xyz.com:443
 127.0.0.0/8
Live Restore Enabled: false

Added the docker info above.添加了上面的 docker 信息。 Any solutions?任何解决方案? pointers on what I could be doing wrong?关于我可能做错了什么的指针?

docker client version is this: docker 客户端版本是这样的:

13:39 $ docker --version
Docker version 1.13.0, build 49bf474

UPDATE:更新:

Resolved.解决。 Looks like Docker is throwing ambiguous error message when the image does not exist in the repository.当存储库中不存在图像时,Docker 似乎会抛出模棱两可的错误消息。 When I was doing this:当我这样做时:

docker pull my-private-repo.xyz.com:443/platform/abc

I was expecting to pull the image with 'latest' tag to be downloaded.我原以为要下载带有“最新”标签的图像。 In the repository no such image exist with this tag.在存储库中不存在带有此标签的此类图像。 But the error thrown was wrong.但是抛出的错误是错误的。

In addition I also changed my daemon configuration as suggested in the comments to this:此外,我还按照评论中的建议更改了我的守护程序配置:

{
  "experimental" : false,
  "disable-legacy-registry" : true,
  "insecure-registries" : [
    "my-private-repo.xyz.com:443"
  ]
}

And now I am able to pull the image.现在我可以拉图像了。

When you are pulling an image from registry with Docker client, the client will try to send a V2 version request to registry firstly.当您使用 Docker 客户端从注册表中拉取镜像时,客户端将首先尝试向注册表发送 V2 版本请求。 If this request returned with error (ie image not existing or the request is unauthorized), then docker client will fall back and try to send another V1 version request.如果此请求返回错误(即图像不存在或请求未经授权),则 docker 客户端将回退并尝试发送另一个 V1 版本请求。

Since your registry is on a newer version, and it does not support V1 APIs anymore, the registry will throw error such as 'Unsupported docker v1 repository request' in the second V1 request attempting.由于您的注册表是较新版本,并且不再支持 V1 API,因此注册表将在第二次 V1 请求尝试中抛出诸如“不支持的 docker v1 存储库请求”之类的错误。

To avoid this, Docker developer is planning to add the --disable-legacy-registry option to Docker client by default.为了避免这种情况,Docker 开发人员计划默认将--disable-legacy-registry选项添加到 Docker 客户端。 If this option has been set as true, Docker client will not try to send V1 version request again but will return the original error message from initial V2 request.如果此选项已设置为 true,则 Docker 客户端将不会再次尝试发送 V1 版本请求,而是会返回初始 V2 请求的原始错误消息。

For more info, please check this issue: https://github.com/docker/docker/issues/26142#issuecomment-271867508有关更多信息,请查看此问题: https : //github.com/docker/docker/issues/26142#issuecomment-271867508

If you are getting this means that you are using Docker less that version 1.9.如果你得到这意味着你使用的 Docker 低于 1.9 版。 Docker has deprecated the v1 registries from this version. Docker 已弃用此版本的 v1 注册表。 Please check these following things请检查以下事项

  1. check docker version docker --version and docker info检查 docker 版本docker --versiondocker info
  2. check for the registries registered with the docker, if you have configured more than one registry in Docker then you need to check which registry is configured with v1 registry.检查在 docker 中注册的注册表,如果您在 Docker 中配置了多个注册表,那么您需要检查哪个注册表配置了 v1 注册表。

docker run --rm --pid=host alpine ps aux | docker run --rm --pid=host alpine ps aux | grep dockerd grep dockerd

The above command will show you how many Docker registries are configured in your system.上面的命令将显示您的系统中配置了多少 Docker 注册表。 if there are multiple, please check by removing and configuring one by one.如果有多个,请通过删除和配置一一检查。

so if it has more than one registry setup please check each registry and check the configuration if its supports v2 or not.因此,如果它有多个注册表设置,请检查每个注册表并检查其配置是否支持 v2。

if you have configured only one registry and facing this issue, I would recommend upgrading the version of Docker greater than 1.9.如果您只配置了一个注册表并面临此问题,我建议将 Docker 版本升级到 1.9 以上。

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

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