compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose: pull unauthorized for private registry

Open stephan2012 opened this issue 10 years ago • 22 comments

While trying to deploy with docker-compose on a Windows system with docker-compose I cannot pull images from a private registry.

$ docker login nexus.company.com:18446
Username (username):
Password:
Login Succeeded

$ docker-compose pull
Pulling memcache (nexus.company.com:18446/custom-memcached:latest)...
Pulling repository nexus.company.com:18446/custom-memcached
ERROR: unauthorized: authentication required

Pulling directly with Docker works as expected:

$ docker pull nexus.company.com:18446/custom-memcached:latest
latest: Pulling from custom-memcached

a3ed95caeb02: Pull complete
da71393503ec: Pull complete
5cd41edb06aa: Pull complete
d7066ba9851d: Pull complete
2bf2935c93e8: Pull complete
039250837ed5: Pull complete
c576cd65c4e9: Pull complete
add8dfd60915: Pull complete
Digest: sha256:3fd27dec38906853c3f700215aaf02986be2e2114f763a5f9c4339f71787e9c5
Status: Downloaded newer image for nexus.company.com:18446/custom-memcached:latest

Versions:

  • docker-compose: 1.8.0-rc1
  • Docker 1.12.0-rc3
  • Docker Toolbox 1.12.0-rc2
  • Registry: Nexus Repository Manager 3.0.0-03
$ docker-machine ip
192.168.99.100

$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\username\.docker\machine\machines\default"

export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)

$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.12.0-rc3
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 10
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.14-boot2docker
Operating System: Boot2Docker 1.12.0-rc3 (TCL 7.1); HEAD : 8d9ee9f - Sat Jul  2 05:02:44 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.9 MiB
Name: default
ID: XXBH:DI6X:DOYG:D3MW:NIML:X5VG:ZBHX:PUEA:BCHW:JDVB:BYRJ:Y5YR
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 13
 Goroutines: 25
 System Time: 2016-07-04T06:52:27.653725638Z
 EventsListeners: 0
Http Proxy: http://proxy.company.com:8080
Https Proxy: http://proxy.company.com:8080
No Proxy: localhost,127.0.0.1,.company.com
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Insecure Registries:
 127.0.0.0/8

Did I miss something or does docker-compose ignore registry logins?

Thanks for your help.

Stephan

stephan2012 avatar Jul 04 '16 06:07 stephan2012

Could you paste the output of docker-compose --verbose pull?

aanand avatar Jul 05 '16 23:07 aanand

Here we go…

$ docker-compose --verbose pull
compose.config.config.find: Using configuration files: .\docker-compose.yml
docker.auth.auth.load_config: File doesn't exist
compose.cli.command.get_client: docker-compose version 1.8.0-rc1, build 9bf6bc6
docker-py version: 1.8.1
CPython version: 2.7.11
OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
compose.cli.command.get_client: Docker base_url: https://192.168.99.100:2376
compose.cli.command.get_client: Docker version: KernelVersion=4.4.14-boot2docker, Os=linux, BuildTime=2016-07-02T00:17:11.584218003+00:00, ApiVersion=1.24, Version=1.12.0-rc3, GitCommit=91e29e8, Arch=amd64, GoVersion=go1.6.2
compose.service.pull: Pulling memcache (nexus.company.com:18446/custom-memcached:latest)...
compose.cli.verbose_proxy.proxy_callable: docker pull <- ('nexus.company.com:18446/custom-memcached', tag=u'latest', stream=True)
docker.api.image.pull: Looking for auth config
docker.api.image.pull: No auth config in memory - loading from filesystem
docker.auth.auth.load_config: File doesn't exist
docker.auth.auth.resolve_authconfig: Looking for auth entry for 'nexus.company.com:18446'
docker.auth.auth.resolve_authconfig: No entry found
docker.api.image.pull: No auth config found
compose.cli.verbose_proxy.proxy_callable: docker pull -> <generator object _stream_helper at 0x0000000003883990>
Pulling repository nexus.company.com:18446/custom-memcached
ERROR: compose.cli.main.main: unauthorized: authentication required

stephan2012 avatar Jul 06 '16 06:07 stephan2012

Anybody having idea why docker reports docker.auth.auth.load_config: File doesn't exist?

stephan2012 avatar Jul 12 '16 13:07 stephan2012

I am also having the EXACT same issue.

brooksa321 avatar Jul 13 '16 15:07 brooksa321

Same here. Here is the log:

compose.config.config.find: Using configuration files: .\docker-compose.yml
docker.auth.auth.load_config: File doesn't exist
compose.cli.command.get_client: docker-compose version 1.8.0-rc1, build 9bf6bc6
docker-py version: 1.8.1
CPython version: 2.7.11
OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
compose.cli.command.get_client: Docker base_url: http://127.0.0.1:2375
compose.cli.command.get_client: Docker version: KernelVersion=4.4.14-moby, Os=linux,     BuildTime=2016-07-05T02:20:13.448965048+00:00, ApiVersion=1.24, Version=1.12.0-rc3,     GitCommit=876f3a7, Arch=amd64, Experimental=True, GoVersion=go1.6.2
compose.service.pull: Pulling dynamodb (registry:443/syzygy/dynamodb:latest)...
compose.cli.verbose_proxy.proxy_callable: docker pull <- ('registry:443/syzygy/dynamodb',     tag=u'latest', stream=True)
docker.api.image.pull: Looking for auth config
docker.api.image.pull: No auth config in memory - loading from filesystem
docker.auth.auth.load_config: File doesn't exist
docker.auth.auth.resolve_authconfig: Looking for auth entry for 'dockerregistry.syzygy.de:443'
docker.auth.auth.resolve_authconfig: No entry found
docker.api.image.pull: No auth config found
compose.cli.verbose_proxy.proxy_callable: docker pull -> <generator object _stream_helper at     0x0000000003961AF8>
Pulling repository registry:443/syzygy/dynamodb
ERROR: compose.cli.main.main: Error: image syzygy/dynamodb:latest not found

sascha-andres avatar Jul 14 '16 12:07 sascha-andres

I've submitted https://github.com/docker/docker-py/pull/1146 to try and help debug this issue. If you installed Compose via pip, you can try it out by installing docker-py from GitHub:

$ pip uninstall docker-py
$ pip install git+git://github.com/aanand/docker-py.git@config-path-debug#egg=docker-py
$ docker-compose --verbose pull

aanand avatar Aug 01 '16 12:08 aanand

Isnt that related to the credential helper? docker-compose, even if found the configuration, will refuse to auth if the credentials are not stored in the config.json but rather in the keychain

EugenMayer avatar Aug 20 '16 17:08 EugenMayer

Just tried the current master with the same negative result:

compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.auth.load_config: Found 'auths' section
docker.auth.auth.parse_auth: Auth data for {0} is absent. Client might be using a credentials store instead.
docker.auth.auth.load_config: Found 'credsStore' section
compose.cli.command.get_client: docker-compose version 1.9.0dev, build acfe100
docker-py version: 1.9.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.2h  3 May 2016
compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket
compose.cli.command.get_client: Docker version: KernelVersion=4.4.17-moby, Os=linux, BuildTime=2016-08-12T18:35:53.398900624+00:00, ApiVersion=1.24, Version=1.12.1-rc1, GitCommit=7889dc7, Arch=amd64, Experimental=True, GoVersion=go1.6.3
compose.service.pull: Pulling consul (registry.com/dw_consul:latest)...
compose.cli.verbose_proxy.proxy_callable: docker pull <- ('registry.com/dw_consul', tag=u'latest', stream=True)
docker.api.image.pull: Looking for auth config
docker.auth.auth.resolve_authconfig: Looking for auth entry for 'registry.com'
docker.auth.auth.resolve_authconfig: No entry found
docker.api.image.pull: No auth config found
compose.cli.verbose_proxy.proxy_callable: docker pull -> <generator object _stream_helper at 0x105759370>

i replaced my actual domain with registry.com just if somebody wonders. docker pull image does work without any issues.

EugenMayer avatar Aug 21 '16 07:08 EugenMayer

I have the same issue as EugenMayer

spunkedy avatar Aug 30 '16 21:08 spunkedy

Same issue here too...

Stono avatar Sep 01 '16 15:09 Stono

I have an issue with unauthorized: authentication required reported by docker run when $DOCKER_HOST is set (to a non-remote machine) while running the docker run over ssh on that host works. Do you think it's the same issue?

pasky avatar Sep 15 '16 15:09 pasky

@aanand workaround didn't work for me, but re-installing it did:

pip uninstall docker-py
pip install git+git://github.com/aanand/docker-py.git@config-path-debug#egg=docker-py
docker-compose --verbose pull
pip install docker-py

fdattein avatar Sep 18 '16 02:09 fdattein

I ran into a similar problem and I was able to get around it by changing my ~/.docker/config.json to be the old format:

new format:

{
        "auths": {
                "my.registry.com": {}
        },
        "credsStore": "wincred"
}

old format:

{
        "auths": {
                "my.registry.com": {
                        "auth": "<some long string>",
                        "email": "[email protected]"
                }
        }
}

jianfeiliao avatar Sep 26 '16 22:09 jianfeiliao

Same issue here too, but only on Windows 10. It works fine for me on OSX.

UPDATE: Had the issue with 12.1-stable, but it authenticates OK now in 1.12.2-rc1-beta27.1.

rooch84 avatar Oct 06 '16 09:10 rooch84

It does not work for me with 1.12.3-Beta23. Docker pull works as expected docker-compose doesn't.

Kemyke avatar Nov 08 '16 12:11 Kemyke

Same issue on Windows 7.

  • Docker version 1.12.0, build 8eab29e
  • docker-compose version 1.8.0, build d988a55
  • Private registry Nexus Repository ManagerOSS 3.0.1-0

Pulling works well with docker login + docker pull, With docker-compose --verbose up:

docker.api.image.pull: Looking for auth config docker.api.image.pull: No auth config in memory - loading from filesystem docker.auth.auth.load_config: File doesn't exist docker.auth.auth.resolve_authconfig: Looking for auth entry for 'myprivateregistry' docker.auth.auth.resolve_authconfig: No entry found docker.api.image.pull: No auth config found compose.cli.verbose_proxy.proxy_callable: docker pull -> <generator object _stream_helper at 0x0000000003633480> Pulling repository myprivateregistry/mycontainer ERROR: compose.cli.main.main: unauthorized: authentication required

myprivateregistry is configured with https and declared as unsecured in my docker machine / host configuration (because the certificates is auto signed)

jraduget avatar Nov 26 '16 06:11 jraduget

Any progress?

davidkarlsen avatar Dec 06 '16 14:12 davidkarlsen

wrong comment

EugenMayer avatar Dec 06 '16 17:12 EugenMayer

I'm experiencing the same problem with Nexus + Docker 1.13 Swarm mode and using docker stack. The image pulling process fails with:

Rejected 5 minutes ago "No such image: nexus.domain.tld/name/image

but if I pull it manually with

docker pull nexus.domain.tld/name/image

then Swarm can launch it properly.

vide avatar Jan 31 '17 10:01 vide

@vide Please create a new issue on docker/docker for anything pertaining to docker stack commands.

Authentication issues for docker-compose when pulling/building should all be resolved with 1.10.0. If you find out that's not the case, please open a new issue describing the problem.

shin- avatar Feb 01 '17 22:02 shin-