Giter VIP home page Giter VIP logo

Comments (6)

rhatdan avatar rhatdan commented on June 15, 2024

Interested in opening a PR to make this work better?

from common.

damienrg avatar damienrg commented on June 15, 2024

Yes I can open one and at the same time I need to know what result you expect.

To compare docker and podman I have used ~/.docker/config.json with:

{
    "credHelpers": {
        "foo.io": "pass"
    }
}

Actual behavior:

With docker:

$ docker-credential-pass list
{}

$ docker login foo.io # docker asks for username and password
Username: my_username
Password:
Login Succeeded # docker stores credential in pass database

$ docker-credential-pass list
{"foo.io":"my_username"}

$ docker login foo.io
Authenticating with existing credentials...
Login Succeeded

$ docker logout foo.io
Removing login credentials for foo.io # docker removes credential in pass database

$ docker-credential-pass list
{}

With podman:

$ docker-credential-pass list
{}

$ podman login foo.io # podman asks for username and password
Username: my_username
Password:
Login Succeeded # podman stores credential in base64 in `/run/user/uid/containers/auth.json`

$ docker-credential-pass list
{}

$ podman logout foo.io
Removed login credentials for foo.io

$ docker-credential-pass store
{"ServerURL":"foo.io","Username":"my_username","Secret":"my_secret"}

$ docker-credential-pass list
{"foo.io":"my_username"}

$ podman login foo.io
Authenticating with existing credentials...
Existing credentials are valid. Already logged in to foo.io

$ podman logout foo.io
Not logged into foo.io with current tool. Existing credentials were established via docker login. Please use docker logout instead.

$ docker-credential-pass list
{"foo.io":"my_username"}

To sum up docker stores the password in pass on login if not already present and delete the password in pass on logout while podman retrieves credentials with pass if present and fallback to base64 if not and podman never updates pass database.

Side note:

In my tests I had to specify export GPG_TTY=$(tty) to be able to enter my passphrase with podman because it starts a specific gpg-agent and does not use the global one:

# before any podman commands that need access to registry

$ ps -fp "$(pgrep -d, -x gpg-agent)"
UID                  PID    PPID  C STIME TTY          TIME CMD
my_username         4010    2420  0 08:39 ?        00:00:05 /usr/bin/gpg-agent --supervised

# after a podman command that needs access to registry

$ ps -fp "$(pgrep -d, -x gpg-agent)"
UID                  PID    PPID  C STIME TTY          TIME CMD
my_username         4010    2420  0 08:39 ?        00:00:05 /usr/bin/gpg-agent --supervised
my_username        33240    2420  1 09:31 ?        00:00:00 gpg-agent --homedir /home/my_username/.gnupg --use-standard-socket --daemon

Proposal:

For me, docker/podman login/logout should not be used when used with pass (this assumes that people use a passphrase) or only as a simpler alternative to docker-credential-pass store/erase.

Ideally it is not only messages that should change, I propose to:

  • document that login/logout actually store and delete credentials and that they may not be necessary when the password is stored with pass
  • only use the credentials helper specified for a registry and triggers an error if not possible (ie no fallback)
  • let podman use global gpg-agent and not a specific one
  • change podman login/logout (behavior and messages) to match docker as you want to be compatible

from common.

rhatdan avatar rhatdan commented on June 15, 2024

Podman will not use the dockerfile location by default.

You need to either set DOCKER_HOST or use --auth-file to point at the config.

podman login --auth-file ~/.docker/config.json foo.io

from common.

damienrg avatar damienrg commented on June 15, 2024

Podman will not use the dockerfile location by default.

You mean to store credentials in the authentication file or to read authentication file? If the latter,
based on my tests and the code I would say that podman fallbacks by default. Login() calls config.GetCredentials() that explicitly states:

GetCredentials returns the registry credentials stored in the
registry-specific credential helpers or in the default global credentials
helpers with falling back to using either auth.json
file or .docker/config.json, including support for OAuth2 and IdentityToken.
If an entry is not found, an empty struct is returned.

from common.

rhatdan avatar rhatdan commented on June 15, 2024

Are you seeing the expected behaviour?

from common.

damienrg avatar damienrg commented on June 15, 2024

I do not get it. If you talk about ~/.docker/config.json yes podman uses it as fallbacks, if you talk about the issue then no, there was no replies about my proposal.

from common.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.