122

Docker Hub official website has been moved to https://registry.hub.docker.com from https://hub.docker.com/.

If I try to docker pull images from URL like: docker pull registry.hub.docker.com/busybox it shows:

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.

But if I use docker pull registry.hub.docker.com/busybox.

It cannot pull the image.

Same situation when using curl -k https://registry.hub.docker.com/v1/repositories/busybox/tags

UPDATE AS of 2022 / Q3: use docker.io example docker.io/nginx

Christian Matthew
  • 4,014
  • 4
  • 33
  • 43
Ertuğrul Altınboğa
  • 2,187
  • 4
  • 17
  • 25

8 Answers8

121

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
konrad
  • 3,340
  • 1
  • 27
  • 26
  • 10
    any idea with personal images ? I mean for / container, any help with full url ? – José Ibañez Dec 06 '17 at 17:53
  • 2
    @JoséIbañez, did you try `docker pull registry.hub.docker.com//` ? – forzagreen Sep 25 '18 at 15:37
  • 3
    The URL to use is `docker pull index.docker.io/library/busybox` – dtheodor Sep 26 '18 at 08:52
  • 31
    I think it's safest to use `docker.io` instead of `registry.hub.docker.com`, `index.docker.io`, etc because it is the most generic alias. The [registry docs](https://docs.docker.com/registry/introduction/) say "`docker pull ubuntu` ... is simply a shortcut for the longer `docker pull docker.io/library/ubuntu` command" – wisbucky Nov 13 '19 at 20:02
  • 1
    @wisbucky omg GEEZ OH MAN thank you. My goodness why was this so ridiculous to find. – Christian Matthew Aug 21 '22 at 01:54
114

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)

nsof
  • 2,299
  • 1
  • 20
  • 28
  • 5
    I agree that `docker.io` seems like the safest url to use (least likely to change/break in the future). The [registry docs](https://docs.docker.com/registry/introduction/) say "docker pull ubuntu ... is simply a shortcut for the longer docker pull docker.io/library/ubuntu command". – wisbucky Nov 13 '19 at 19:44
  • 1
    docker.io works out of the box – The Tran Mar 23 '22 at 02:36
39

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/
Florian Neumann
  • 5,587
  • 1
  • 39
  • 48
  • 4
    Given that the registry URL could change in the future, using `docker info` would seem to be the safest method. – Raedwald Apr 01 '19 at 12:08
  • 1
    It's wright @Raedwald. Moreover, `docker info` works on Windows, `grep` doesn't. – Roberto C. Rodriguez-Hidalgo Jul 18 '21 at 20:59
  • Thanks for your hint @RobertoC.Rodriguez-Hidalgo, i drafted a Windows version of the command. Unfortunately i'm not able to test it (no Windows available). – Florian Neumann Jul 19 '21 at 10:28
  • The URL is actually an [index server address](https://github.com/docker/cli/blob/v20.10.18/cli/command/system/info.go#L255). A while ago there seemed to be a [difference](https://stackoverflow.com/questions/28394930) between an index server and a registry. These days I'm not sure. Anyway, the response I get is 404. Although with /v2/ it works. Which sounds suspicious. I'd use the one that `docker` uses. And that's `registry-1.docker.io`. See [my answer](https://stackoverflow.com/a/73893304/52499). – x-yuri Sep 29 '22 at 18:45
  • Interesting - i don't have issues using index.docker.io.. I have an eye on it.. – Florian Neumann Oct 06 '22 at 09:20
  • 1
    There are some compatibility issues at play here. A lot of source code depends on the way things work right now. But they're planning to change something. More on it [here](https://github.com/docker/cli/issues/3793#issuecomment-1269051403). About 404 I meant the exact URL in your answer. You can use the registry API with `index.docker.io`, but `/v1/` results in 404. And the source code uses `registry-1.docker.io` (e.g. `docker pull`). So I find the latter more preferable. – x-yuri Oct 11 '22 at 22:04
  • Good finding - thank you @x-yuri - i hope they will update the url the registry field of the `docker info` output points at.. i keep an eye on it. But the `index.docker.io` output here should have been taken as example output. IMaybe i should make tha answer more clear on that. – Florian Neumann Oct 12 '22 at 18:43
15

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/

Muhammad Waqas Dilawar
  • 1,844
  • 1
  • 23
  • 34
DatGuy
  • 151
  • 1
  • 2
  • Second this solution, very useful when using w/ kubernetes secret. The official doc points out that `https://index.docker.io/v1/` is indeed the dockerhub url to use. See: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line – Shawn Jul 17 '19 at 08:34
  • 1
    The `v2` should not be specified in a `pull`, so just e.g. `docker | podman | crictl pull index.docker.io/hello-world` – vorburger Jan 27 '21 at 21:08
  • How come `https://index.docker.io/v1/` is dead, but I still see it when typing `docker info`? docker is so clunky with its documentation.. – Andrius Nov 15 '21 at 16:37
6

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.

x-yuri
  • 16,722
  • 15
  • 114
  • 161
1

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.

booyaa
  • 4,437
  • 2
  • 26
  • 32
  • I know I can use ```docker pull busybox```. But in my case I have using curl to get some information. But I am afraid it will remove in the future. So, I have to check what URL is the latest. – Ertuğrul Altınboğa Dec 10 '15 at 10:29
  • These days the `curl` command responds with 410 GONE. – x-yuri Oct 11 '22 at 22:48
1

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.

James Render
  • 1,490
  • 1
  • 14
  • 26
0

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
Hari K
  • 251
  • 3
  • 8