Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

{
  "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. Any solutions? pointers on what I could be doing wrong?

docker client version is this:

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. 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.

like image 550
itpragmatik Avatar asked Jan 24 '17 20:01

itpragmatik


People also ask

How do I access private registry Docker?

To supply credentials to pull from a private registry, add a . dockercfg to the uris field of your app. The $HOME environment variable will then be set to the same value as $MESOS_SANDBOX so Docker can automatically pick up the config file.

How do I access private Docker images?

Log in to Docker Hub On your laptop, you must authenticate with a registry in order to pull a private image. Use the docker tool to log in to Docker Hub. See the log in section of Docker ID accounts for more information.

How do I push a Docker image to a public repository?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).


1 Answers

When you are pulling an image from registry with Docker client, the client will try to send a V2 version request to registry firstly. If this request returned with error (i.e. image not existing or the request is unauthorized), then docker client will fall back and try to send another V1 version request.

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.

To avoid this, Docker developer is planning to add the --disable-legacy-registry option to Docker client by default. 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.

For more info, please check this issue: https://github.com/docker/docker/issues/26142#issuecomment-271867508

like image 98
Haoming Zhang Avatar answered Nov 16 '22 01:11

Haoming Zhang