compose icon indicating copy to clipboard operation
compose copied to clipboard

Pull image from private registry

Open mestihudson opened this issue 11 years ago • 14 comments

Hi,

I was trying to pull an image from private registry and I received this message:

[root@baleia sinesp-seguranca]# docker-compose up
Creating sinespseguranca_ldap_1...
Pulling image baleia:5000/sinesp.ldap:latest...
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 59, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 445, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 184, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 259, in recreate_containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 242, in create_container
  File "/code/build/docker-compose/out00-PYZ.pyz/docker.client", line 824, in pull
  File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 67, in resolve_repository_name
  File "/code/build/docker-compose/out00-PYZ.pyz/docker.auth.auth", line 46, in expand_registry_url
docker.errors.DockerException: HTTPS endpoint unresponsive and insecure mode isn't enabled.
[root@baleia sinesp-seguranca]# 

This is my docker-compose.yml file content:

ldap:
  image: baleia:5000/sinesp.ldap
  command: /run.sh
  ports:
    - "389:389"
    - "9830:9830"
  environment:
    ADMIN_DOMAIN: sinesp.bsa.serpro
    SERVER_IDENTIFIER: sinesp
    FULL_MACHINE_NAME: ldap.sinesp.bsa.serpro
    CONFIG_DIR_ADMIN_PWD: password1
    ROOT_DN_PWD: password2
    SUFFIX: dc=sinesp,dc=bsa,dc=serpro
  hostname: ldap.sinesp.bsa.serpro

And this is my /etc/sysconfig/docker file content:

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS=--selinux-enabled -H fd:// --insecure-registry baleia:5000

# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp

I have got to push that image on my private registry. What is wrong?

mestihudson avatar Mar 19 '15 18:03 mestihudson

I faced a similar issue, like you I'm using my own insecure registry. Apparently "docker-compose" does not seem to enforce the "--insecure-registry" you have in the Docker daemon config file. Instead I had to explicitly tell "docker-compose" to trust your insecure registry like this:

docker-compose up --allow-insecure-registry

It also works for the "run" command, as in:

docker-compose run --allow-insecure-registry myServiceName

For more info on those commands you can do:

docker-compose up --help docker-compose run --help

Whether "docker-compose" should by default honor the Docker daemon setting "--insecure-registry" when no "--allow-insecure-registry" is provided via compose, is something I'd like to know as well...

donhector avatar Mar 24 '15 06:03 donhector

Not sure if this is related but after I login with docker login to quay. I'm still not shown as authenticated when using docker-compose up:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.1.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib64/python2.7/site-packages/compose/cli/main.py", line 31, in main
    command.sys_dispatch()
  File "/usr/lib64/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/usr/lib64/python2.7/site-packages/compose/cli/command.py", line 27, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/usr/lib64/python2.7/site-packages/compose/cli/command.py", line 59, in perform_command
    handler(project, command_options)
  File "/usr/lib64/python2.7/site-packages/compose/cli/main.py", line 445, in up
    do_build=not options['--no-build'],
  File "/usr/lib64/python2.7/site-packages/compose/project.py", line 184, in up
    do_build=do_build):
  File "/usr/lib64/python2.7/site-packages/compose/service.py", line 259, in recreate_containers
    **override_options)
  File "/usr/lib64/python2.7/site-packages/compose/service.py", line 244, in create_container
    stream_output(output, sys.stdout)
  File "/usr/lib64/python2.7/site-packages/compose/progress_stream.py", line 37, in stream_output
    print_output_event(event, stream, is_terminal)
  File "/usr/lib64/python2.7/site-packages/compose/progress_stream.py", line 50, in print_output_event
    raise StreamOutputError(event['errorDetail']['message'])
compose.progress_stream.StreamOutputError: HTTP code: 403

This is received after trying to pull a private image from quay after having logged in successfully with docker login. I have verified that I have access to the repository by successfully doing:

docker pull quay.io/private/repo

alunduil avatar Mar 24 '15 15:03 alunduil

same here

radekdymacz avatar Mar 24 '15 16:03 radekdymacz

Also having issues using images in private repositories (quay.io). It seems like docker-compose isn't loading the ~/.dockercfg file and therefore getting a 403 when trying to do the pull.

Looking at the upstream docker-py client, there is code to make this work. Perhaps docker-compose's vendored version doesn't have it?

d11wtq avatar Mar 26 '15 06:03 d11wtq

Yes, that's exactly what it is, version 1.1.0 of docker-compose is vendoring docker-py 0.7.2 which doesn't have authentication. It also enforces a version <0.8 for docker-py which means installing via pip doesn't help. Installing the 1.2.0rc4 from binary fixed the issue for me.

For users of homebrew, I've just created a formula for it until 1.2.0 is available on homebrew itself:

$ brew tap elbaschid/docker
$ brew update
$ brew install docker-compose

roadsideseb avatar Apr 10 '15 22:04 roadsideseb

Installing 1.2.0rc4 doesn't solve the issue for me. Also trying to pull from quay.io

guillaume-brossard avatar Apr 14 '15 00:04 guillaume-brossard

Using docker-py-1.1.0 appears to solve this issue. Is docker-py still bundled? If so can we get it unbundled?

alunduil avatar Apr 14 '15 15:04 alunduil

The flag

--allow-insecure-registry

Doesn't resolve that for me. Please have a look also here where I describe my problem: #1319

phlegx avatar Apr 22 '15 07:04 phlegx

Same problem here.

docker pull myregistry/something - works docker-compose up - results in compose.progress_stream.StreamOutputError: Authentication is required.

Running a private registry with valid ssl certificate and basic auth. /usr/local/bin/docker-compose --version docker-compose 1.2.0

brianlund avatar Apr 29 '15 13:04 brianlund

Duplicate of #75

aanand avatar Apr 29 '15 17:04 aanand

Still have the same issue even in 1.4.0rc2. Try docker-compose up on quay.io and receive:

Status 403 trying to pull repository x-repository/activemq: "{\"error\": \"Permission Denied\"}"

normal pull from the same repository works fine

vicmosin avatar Jul 28 '15 12:07 vicmosin

@vicmosin did you managed to fix this ?

sabretus avatar Nov 10 '15 12:11 sabretus

@sabretus Nope

vicmosin avatar Nov 10 '15 12:11 vicmosin

having the same error, this works for me on ubunut vivid (15.04) and docker-compose 1.2 / docker 1.9.1:

docker-compose pull --allow-insecure-ssl

I have this problem using docker-compose 1.2 so upgrade did the trick too..

https://github.com/docker/compose/releases

fabtho avatar Apr 14 '16 08:04 fabtho