genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.9k stars 231 forks source link

Pull/push with .docker/config.json #189

Closed andrewtchin closed 5 years ago

andrewtchin commented 5 years ago

https://github.com/genuinetools/img/blob/master/README.md#running-with-docker seems to imply that img can use credentials from Docker's config.json for at least push. Is this the case? I couldn't get it to work with the binary (I didn't try the container):

⇒  env | grep DOCKER_CONFIG
DOCKER_CONFIG=/home/chin/.docker

⇒  img ls
NAME                                SIZE        CREATED AT    UPDATED AT    DIGEST
X.bintray.io/chin-test:latest    91.41MiB    4 seconds ago    4 seconds ago    sha256:e5ee7c05bc6b4e0d010e5e9db47bb4a18a2b85eca21a515ceb7119b520ad9f54

⇒  img push X.bintray.io/chin-test:latest
Pushing X.bintray.io/chin-test:latest...
unexpected response: 401 Unauthorized

⇒  cat ~/.docker/config.json 
{
    "auths": {
        "X.bintray.io": {
            "auth": "ZZZ"
        }
    },
    "HttpHeaders": {
        "User-Agent": "Docker-Client/18.06.1-ce (linux)"
    }
}%  

I would also like to use img with config.json to pull, but that also gives a 401.

Though not strictly required if pull/push work directly, it seems that img login reads the correct username from config.json, but does not use the credential that is present.

topjor commented 5 years ago

I think this falls under / should be linked to #128 Looks like the same issues as I and others are having

jessfraz commented 5 years ago

ah yeah seems to be a bintray thing :) will link in #128

andrewtchin commented 5 years ago

Ah yea I forgot to update this. We did some more debugging and I opened a support case with Bintray to fix their API. Thanks @jessfraz and @topjor

topjor commented 5 years ago

I just found out what the real issue is and commented on the other issue, see #128. You probably want to give this information to Bintray as well, so they can fix this compatibility issue.