Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crane: auth get doesn't work with default keychain on Mac M1 + Podman #1976

Open
kostola opened this issue Jul 16, 2024 · 3 comments · May be fixed by #1977
Open

crane: auth get doesn't work with default keychain on Mac M1 + Podman #1976

kostola opened this issue Jul 16, 2024 · 3 comments · May be fixed by #1977
Labels
bug Something isn't working

Comments

@kostola
Copy link

kostola commented Jul 16, 2024

Describe the bug

On a Mac M1 laptop with Podman (running through Podman Machine), crane auth get <registry> fails with credentials not found in native keychain even if podman itself is successfully logged into the same registry.

Credentials are correctly stored in $HOME/.config/containers/auth.json

To Reproduce

  1. Login with podman to the target registry: podman login <registry>
  2. Try to retrieve credentials for the same registry with crane: crane auth get <registry>

Expected behavior

Crane should return the expected output for crane auth get: a JSON containing the credentials, like:

{"Username":"kostola","Secret":"<redacted>"}

Additional context

  • Output of crane version: 0.19.1
  • Registry used: docker.io, ghcr.io, quay.io
@kostola kostola added the bug Something isn't working label Jul 16, 2024
@kostola
Copy link
Author

kostola commented Jul 16, 2024

Looking at the code, the default keychain looks for credential into (in order):

  1. $HOME/.docker/config.json
  2. $DOCKER_CONFIG/config.json
  3. $REGISTRY_AUTH_FILE
  4. $XDG_RUNTIME_DIR/containers/auth.json

1 and 2 are Docker related, 3 is intended as explicit override by the user and 4 doesn't work because XDG_RUNTIME_DIR is not set in macOS.

Podman login docs, however, state that:

--authfile=path
Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json on Linux, and $HOME/.config/containers/auth.json on Windows/macOS.

It seems like option 4 should consider the host OS.

@nmcostello
Copy link

Omg, I just independently wrote the same fix 🤦

#2014

@kostola
Copy link
Author

kostola commented Oct 15, 2024

@jonjohnsonjr @imjasonh I am pinging you as top contributors. What do you think of this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants