Skip to content

Basic authentication not working #241

Closed as not planned
Closed as not planned

Description

@dlip

I have a private registry with basic authentication, but for some reason the following code doesn't work:

import docker
client = docker.Client()
print client.login("myuser", password="mypassword", email="[email protected]", registry="docker.mytrax.co.jp")
print client.pull("docker.mytrax.co.jp/mytraxwp-app", tag="latest")
{u'Status': u'Login Succeeded'}
{"status":"Pulling repository docker.mytrax.co.jp/mytraxwp-app"}
{"errorDetail":{"message":"Authentication is required."},"error":"Authentication is required."}

My Nginx log says:

 - - [13/Jun/2014:07:09:05 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http"
 - - [13/Jun/2014:07:09:05 +0000] "POST /v1/users/ HTTP/1.1" 401 194 "-" "Go 1.1 package http"
 - myuser [13/Jun/2014:07:09:05 +0000] "GET /v1/users/ HTTP/1.1" 200 4 "-" "docker/0.11.1 go/go1.2.1 kernel/2.6.32-431.el6.x86_64 os/linux arch/amd64"
 - - [13/Jun/2014:07:09:05 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "python-requests/2.2.1 CPython/2.6.6 Linux/2.6.32-431.el6.x86_64"
 - - [13/Jun/2014:07:09:05 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http"
 - - [13/Jun/2014:07:09:05 +0000] "GET /v1/_ping HTTP/1.1" 200 4 "-" "Go 1.1 package http"
 - - [13/Jun/2014:07:09:05 +0000] "GET /v1/repositories/mytraxwp-app/images HTTP/1.1" 401 194 "-" "docker/0.11.1 go/go1.2.1 kernel/2.6.32-431.el6.x86_64 os/linux arch/amd64"

Activity

  1. dlip commented on Jun 14, 2014

    @dlip
    Author

    I have gotten it working by changing
    registry="docker.mytrax.co.jp" to registry="https://docker.mytrax.co.jp/v1/".

    I'm not sure why its so sensitive, but these say login succeeded, but I can't pull:

    docker.mytrax.co.jp

    https://docker.mytrax.co.jp

  2. shin- commented on Jun 17, 2014

    @shin-
    Contributor

    Yeah, the whole auth is kind of designed that way. I'm sure there's something smart we could do here, but it's not a huge priority. If you want to contribute I'd be happy to merge a patch that improves this behavior.

    Thanks!

  3. gregtap commented on Dec 22, 2014

    @gregtap

    That did the trick indeed 👍

  4. dverbeek84 commented on Feb 15, 2015

    @dverbeek84

    I have the same problem
    it is in the requests library docker-py use this for ping(if site is online)

    if i use request from my mac:

    >>> import requests
    >>> requests.get("https://index.onegini.com/v1/_ping", timeout=3)
    <Response [200]>
    

    and in my VM

    >>> import requests
    >>> requests.get("https://index.onegini.com", timeout=3)
    <Response [503]>
    

    So there is a problem

    Also the request from my MAC is forward by HAProxy to the docker index but from my VM not.
    I see the request in my HAProxy but not in the docker index.

  5. mpetazzoni commented on Feb 18, 2015

    @mpetazzoni
    Contributor

    Didn't you mean to use /v1/_ping in the command executed inside the VM too?

  6. tonicmuroq commented on Mar 2, 2015

    @tonicmuroq
    Contributor

    I got this problem, too.
    If I set registry without '/v1/', client told me that I had successfully logged in, but I couldn't do any push / pull. It seems I have to set registry ends with '/v1/'... Don't you think it weird?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions