Skip to content

Add support for registry authentication #75

Closed
docker/docker-py
#507

Description

@ahromis

I was having issues with the cert chain, so I followed what is on this thread for docker-osx: moby/moby#3683 . I'm able to do a docker login just fine using a new binary on mac os x.

However when using fig and having the Dockerfile pull from the same private registry I get the following error using fig build:

Step 1 : FROM ssl-repo.com/image
Pulling repository ssl-repo.com/image
Error: Authentication is required.

Does fig read the .dockercfg? Any other ideas on what the issue could be here?

Activity

  1. bfirsh commented on Feb 4, 2014

    @bfirsh

    No it doesn't, and we should support that. Thanks for the suggestion!

  2. zazabe commented on Aug 20, 2014

    @zazabe

    @thpham Thanks, works fine with the official private repository in version 0.8.0.
    Just a note, you have to use a full url at login and in your fig.yml file, with the protocol part.

  3. allenan commented on Oct 24, 2014

    @allenan

    Really looking for this functionality as well. Any suggested workarounds for the time being?

  4. matthuisman commented on Nov 3, 2014

    @matthuisman

    I'm having a similar issue using a private registry:

    nginx:
    image: docker.mydomain.com/matt/nginx:latest
    ports:
    - "80:80"

    If I do docker pull docker.mydomain.com/matt/nginx:latest
    it works fine

    However, if I do a fig up
    I get:

    Pulling nginx (docker.mydomain.com/matt/nginx:latest )...
    Traceback (most recent call last):
    File "", line 3, in
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 31, in main
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 28, in dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 51, in perform_command
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 225, in pull
    File "/code/build/fig/out00-PYZ.pyz/fig.project", line 185, in pull
    File "/code/build/fig/out00-PYZ.pyz/fig.service", line 431, in pull
    File "/code/build/fig/out00-PYZ.pyz/docker.client", line 733, in pull
    File "/code/build/fig/out00-PYZ.pyz/docker.auth.auth", line 69, in resolve_repository_name
    File "/code/build/fig/out00-PYZ.pyz/docker.auth.auth", line 48, in expand_registry_url
    docker.errors.DockerException: HTTPS endpoint unresponsive and insecure mode isn't enabled.

    Any ideas?

  5. mattupstate commented on Nov 19, 2014

    @mattupstate

    @matthuisman you might try setting an environment variable in the shell you're calling fig from:

    $ REQUESTS_CA_BUNDLE=/path/to/ca.crt fig <command>
    

    This might help since fig uses the requests library internally and it supports this env var.

  6. chadshowalter commented on Dec 9, 2014

    @chadshowalter

    I'm having a similar issue. If I don't set REQUESTS_CA_BUNDLE, I see the stacktrace posted by @matthuisman. If I set REQUESTS_CA_BUNDLE to the path to my crt, I get:

    Pulling image my-private-docker-registry:8080/demo-simulator:10...
    Traceback (most recent call last):
    File "", line 3, in
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 31, in main
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 28, in dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 56, in perform_command
    File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 427, in up
    File "/code/build/fig/out00-PYZ.pyz/fig.project", line 174, in up
    File "/code/build/fig/out00-PYZ.pyz/fig.service", line 199, in recreate_containers
    File "/code/build/fig/out00-PYZ.pyz/fig.service", line 187, in create_container
    File "/code/build/fig/out00-PYZ.pyz/fig.progress_stream", line 37, in stream_output
    File "/code/build/fig/out00-PYZ.pyz/fig.progress_stream", line 50, in print_output_event
    fig.progress_stream.StreamOutputError: Authentication is required.

    If instead I do:

    docker pull my-private-docker-registry:8080/demo-simulator:10

    it works (assuming my .dockercfg includes a valid login).

    Is there a workaround, or is using fig with a SSL private repository currently not supported?

  7. amosschallich commented on Dec 13, 2014

    @amosschallich

    I am still having the issue with logging in to a private repository.
    It seems from other commenters that this may have been solved, but I cannot get it to work with Fig 1.0.1.
    Any sample fig.yml file that shows how to use a Basic Auth with a private repository behind https would be greatly appreciated.

  8. gregtap commented on Dec 15, 2014

    @gregtap

    Same issue here even with latest src from master.

    Pulling image registry.xxxx.com/live:dev...
    Traceback (most recent call last):
      File "/usr/local/bin/fig", line 9, in <module>
    load_entry_point('fig==1.0.1', 'console_scripts', 'fig')()
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/main.py", line 31, in main
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/docopt_command.py", line 21, in sys_dispatch
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/command.py", line 28, in dispatch
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/docopt_command.py", line 24, in dispatch
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/command.py", line 56, in perform_command
       File "build/bdist.macosx-10.10-intel/egg/fig/cli/main.py", line 434, in up
       File "build/bdist.macosx-10.10-intel/egg/fig/project.py", line 174, in up
       File "build/bdist.macosx-10.10-intel/egg/fig/service.py", line 222, in recreate_containers
       File "build/bdist.macosx-10.10-intel/egg/fig/service.py", line 210, in create_container
       File "build/bdist.macosx-10.10-intel/egg/fig/progress_stream.py", line 37, in stream_output
       File "build/bdist.macosx-10.10-intel/egg/fig/progress_stream.py", line 50, in print_output_event
    

    fig.progress_stream.StreamOutputError: Authentication is required.

    When I add a:

    print self.client.info()
    

    In service.py L207 it clearly states:

    {
        "KernelVersion": "3.16.7-tinycore64",
        "NFd": 36,
        "Debug": 1,
        ....
       "IndexServerAddress": "https://index.docker.io/v1/",
    

    }

    It seems that the IndexServerAddress is not updated to my own private repo.

    However self.client._auth_configs returns what seems to be the proper conf.

    {u'https://registry.xxxxx.com': {'username': xxxx', 'password': u'xxxxxx', 'email': u'xxxx@xxxxx', 'serveraddress': u'https://registry.xxxx.com'}}
    
  9. JamesStewy commented on Dec 22, 2014

    @JamesStewy

    I had the same issue as well. After looking around in docker-py I found docker/docker-py#241. The solution found was to add /v1/ to the registry address. You can do this in two ways either edit .dockercfg and change the registry address to https://mydomain.com/v1/ or run docker logout https://mydomain.com/ and then docker login https://mydomain.com/v1/. Both Docker and Fig work with this configuration. Tested with Docker 1.3.2, Fig 1.0.1 and Docker Registry 0.9.0.

  10. amosschallich commented on Dec 22, 2014

    @amosschallich

    This worked for me as well. Thank you for the update

  11. cedvan commented on Dec 26, 2014

    @cedvan

    👍 docker login https://mydomain.com/v1/ work

  12. rafael commented on Dec 29, 2014

    @rafael

    The docker login didn't do the trick on Docker 1.4.1 and fig 1.0.1. Does anyone know about any other workaround?

  13. JamesStewy commented on Jan 2, 2015

    @JamesStewy

    @rafael adding /v1/ to the address still works for me with Docker 1.4.1. Which program (Docker or Fig) doesn't work and what error are you receiving? Also, what is the version of the Docker Registry you are trying to connect to?

  14. 65 remaining items

  15. aanand commented on Jul 17, 2015

    @aanand

    @tuanmh That's been fixed. Please update Compose to 1.3.3.

  16. aanand commented on Jul 20, 2015

    @aanand

    If you're experiencing "HTTPS endpoint unresponsive and insecure mode isn't enabled", two things:

  17. aanand commented on Jul 23, 2015

    @aanand

    Update: "HTTPS endpoint unresponsive and insecure mode isn't enabled" has been fixed by #1736 and released in Compose 1.4.0 RC2.

  18. jammylee commented on Jul 30, 2015

    @jammylee

    Hi,

    I was having the same issue of docker pull working on quay.io, but docker-compose pull gives 403. I tried the /v1/ workaround and it didn't help. I have also installed docker-compose 1.4.0rc2, but still get the error:

    Error: Status 403 trying to pull repository _______________: "{"error": "Permission Denied"}"

    my docker version is 1.6.2, and this is in the OSX boot2docker environment.

    I also tried the test.py and the script is able to return my credential without any issue.

  19. aanand commented on Jul 30, 2015

    @aanand

    @jammylee what Compose version? Please try 1.3.3 if you're not already on it.

  20. wleeper commented on Jul 30, 2015

    @wleeper

    Just upgraded to 1.4.0RC2 and am still getting:

    Service 'datasets' failed to build: Error: Status 403 trying to pull repository library/ruby: "{\"error\": \"Unauthorized getting repository images\"}"
    

    When I do a build. Doing a docker pull on the repository throwing the error works fine. The private repository is using artifactory. I have my permissions setup in a global .dockercfg

  21. aanand commented on Jul 30, 2015

    @aanand

    @wleeper What does "when I do a build" mean? Which of the following commands work and don't work?

    docker build <directory>
    docker pull <image>
    docker-compose build
    docker-compose pull
    
  22. jammylee commented on Jul 30, 2015

    @jammylee

    @aanand Hi, thanks for the quick reply. I tried both Compose 1.3.3 and 1.4.0rc2, but for both compose, when I try docker-compose up to pull the quay.io images specified in docker-compose.yml, or simply does docker-compose pull, I continue to get

    Error: Status 403 trying to pull repository _______________: "{"error": "Permission Denied"}"

    however docker pull to pull my private quay.io images works fine

  23. JamesStewy commented on Jul 31, 2015

    @JamesStewy

    Thanks @aanand, 1.4.0RC2 works for me.

  24. ContextMediaBuilder commented on Aug 18, 2015

    @ContextMediaBuilder

    I am still having this issue in 1.4.0 final with Docker 1.8.1.

    Seems like a good way to put quay.io out of business. :*(

  25. alunduil commented on Aug 18, 2015

    @alunduil

    Perhaps this is a docker-py issue? What version of docker-py is everyone using that still experiences this issue? I'm running with docker-1.8.1, docker-py-1.3.1, and docker-compose-1.4.0 without issue.

  26. evenfrost commented on Aug 21, 2015

    @evenfrost

    Having Authentication is required. issue with docker-compose up and private repository with fresh installation on Ubuntu 15.04.

    Docker version 1.8.1, build d12ea79
    docker-compose version: 1.4.0
    docker-py version: 1.3.1
    CPython version: 2.7.9
    
  27. maybetonyfu commented on May 25, 2016

    @maybetonyfu

    I have the same Authentication is required issue with private repository. The case is when I pull image directly from docker client it always works. However if I run docker-compose up it sometimes prompts ERROR: for my-service unauthorized: authentication required, and sometimes doesn't

    # uname -a
    Linux 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    # docker version
    Client:
     Version:      1.10.0
     API version:  1.22
     Go version:   go1.5.3
     Git commit:   590d5108
     Built:        Thu Feb  4 18:36:33 2016
     OS/Arch:      linux/amd64
    
    Server:
     Version:      swarm/1.2.0
     API version:  1.22
     Go version:   go1.5.4
     Git commit:   a6c1f14
     Built:        Wed Apr 13 05:58:31 UTC 2016
     OS/Arch:      linux/amd64
    
    # docker-compose version
    docker-compose version 1.7.0, build 0d7bf73
    docker-py version: 1.8.0
    CPython version: 2.7.9
    OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
    
    
  28. added a commit that references this issue on Jan 19, 2017
    facfce3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions