Docker 官方注册(Docker Hub) URL

Docker Hub 官方网站已从 https://hub.docker.com/移至 https://registry.hub.docker.com

如果我尝试从网址 docker pull图像像: docker pull registry.hub.docker.com/busybox 它显示:

registry.hub.docker.com/busybox: this image was pulled from a legacy registry.
Important: This registry version will not be supported in future versions of docker.

但如果我用 docker pull registry.hub.docker.com/busybox

它无法拉动图像。

使用 curl -k https://registry.hub.docker.com/v1/repositories/busybox/tags时也是同样的情况

2022/Q3年度最新情况: 使用 docker 示例 docker.io/nginx

219166 次浏览

It's just docker pull busybox, are you using an up to date version of the docker client. I think they stopped supporting clients lower than 1.5.

Incidentally that curl works for me:

$ curl -k https://registry.hub.docker.com/v1/repositories/busybox/tags
[{"layer": "fc0db02f", "name": "latest"}, {"layer": "fc0db02f", "name": "1"}, {"layer": "a6dbc8d6", "name": "1-ubuntu"}, {"layer": "a6dbc8d6", "name": "1.21-ubuntu"}, {"layer": "a6dbc8d6", "name": "1.21.0-ubuntu"}, {"layer": "d7057cb0", "name": "1.23"}, {"layer": "d7057cb0", "name": "1.23.2"}, {"layer": "fc0db02f", "name": "1.24"}, {"layer": "3d5bcd78", "name": "1.24.0"}, {"layer": "fc0db02f", "name": "1.24.1"}, {"layer": "1c677c87", "name": "buildroot-2013.08.1"}, {"layer": "0f864637", "name": "buildroot-2014.02"}, {"layer": "a6dbc8d6", "name": "ubuntu"}, {"layer": "ff8f955d", "name": "ubuntu-12.04"}, {"layer": "633fcd11", "name": "ubuntu-14.04"}]

Interesting enough if you sniff the headers you get a HTTP 405 (Method not allowed). I think this might be to do with the fact that Docker have deprecated their Registry API.

The registry path for official images (without a slash in the name) is library/<image>. Try this instead:

docker pull registry.hub.docker.com/library/busybox

I came across this post in search for the dockerhub repo URL when creating a dockerhub kubernetes secret.. figured id share the URL is used with success, hope that's ok.

Live Current: https://index.docker.io/v2/

Dead Orginal: https://index.docker.io/v1/

For those trying to create a Google Cloud instance using the "Deploy a container image to this VM instance." option then the correct url format would be

docker.io/<dockerimagename>:version

The suggestion of registry.hub.docker.com/library/<dockerimagename> did not work for me.

I finally found the solution here (in my case, i was trying to run docker.io/tensorflow/serving:latest)

You're able to get the current registry-url using docker info:

...
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
...

That's also the url you may use to run your self hosted-registry:

docker run -d -p 5000:5000 --name registry -e REGISTRY_PROXY_REMOTEURL=https://index.docker.io registry:2

*ix friends, grep & use it right away:

$ echo $(docker info | grep -oP "(?<=Registry: ).*")
https://index.docker.io/v1/

UNTESTED Windows friends, findstr & use it right away:

$ docker info | findstr /R /C:"(?<=Registry: ).*"
https://index.docker.io/v1/

I drafted a Windows version of the command – unfortunately i'm not able to test it. Please leave a comment if it doesn't work or you have any other feedback. Thanks.

For those wanting to explicitly declare they are pulling from dockerhub when using fabric8 maven plugin, add a new property: <docker.pull.registry>registry.hub.docker.com/library</docker.pull.registry>

I arrived on this page trying to solve problem of pulling from my AWS ECR registry when building Docker images using fabric8.

Use this tool:

https://github.com/amjad489/docker-pull-push

docker-pull-push -s docker.elastic.co/elasticsearch/elasticsearch:7.13 -t AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/elasticsearch:7.13.3


Usage:
docker-pull-push [flags]


Flags:
-p, --awsProfile string     AWS profile (default "default")
-l, --awsRegion string      AWS Region (default "us-east-1")
-h, --help                  help for docker-pull-push
-r, --registryType string   ECR (default "docker")
-s, --sourceImage string    docker.elastic.co/elasticsearch/elasticsearch:7.13
-t, --targetImage string    AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/elasticsearch:7.13.3

tl;dr registry-1.docker.io for API requests, docker.io for docker pull

The situation is tricky and there are plans to address it in the future. I know 3 relevant domains here:

  • index.docker.io (legacy?)
  • docker.io
  • registry-1.docker.io

You can use any of those with docker pull:

  • docker pull index.docker.io/library/alpine
  • docker pull docker.io/library/alpine
  • docker pull registry-1.docker.io/library/alpine

index.docker.io is treated the same as docker.io (the former gets replaced with the latter).

In all three cases registry-1.docker.io is used to connect to the registry. In the first 2 cases that is the default registry URL. In the third case registry-1.docker.io is taken as is.

Then, to use the registry API you can use index.docker.io and registry-1.docker.io (docker.io doesn't work). E.g.:

$ curl -sSv https://registry-1.docker.io/v2/

Also, apparently the domains are going to change in the future.

docker.io is most often used in the context of docker pull. index.docker.io seems to go back to the times where Docker Hub was called Docker Index and to a concept of an index server (searching for images). Actually, that's probably the main purpose of this domain:

https://index.docker.io/v1/search/

Searching isn't a part of the docker registry spec. Or its generalization/successor (?) called OCI Distribution Spec.