-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Docker login in 27.2.0 no longer overwrites existing config.json #5382
Comments
A workaround is to downgrade to |
Thanks for reporting! From that linked ticket; $ docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores
Login Succeeded
$ docker pull registry.gitlab.com/gitlab-org/security-products/analyzers/container-scanning:latest
latest: Pulling from gitlab-org/security-products/analyzers/container-scanning
e4fff0779e6d: Pulling fs layer
,,,
,,,
Digest: sha256:84c7ee8800ce979ef5482d5ca21086f05fbf50d3a477f8194e4b5e87233a5c24
Status: Downloaded newer image for registry.gitlab.com/gitlab-org/security-products/analyzers/container-scanning:latest
registry.gitlab.com/gitlab-org/security-products/analyzers/container-scanning:latest
$ if [ -n "$CS_DEPLOY_USERNAME" ] && [ -n "$CS_DEPLOY_PASSWORD" ]; then # collapsed multi-line command
Login Succeeded
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores
The push refers to repository [registry.gitlab.com/security-products/container-scanning]
5f70bf18a086: Preparing
11c61dfd316c: Preparing
...
...
5f70bf18a086: Layer already exists
b70d9e93136f: Layer already exists
...
...
errors:
denied: requested access to the resource is denied
unauthorized: authentication required Unfortunately the second login call is shown as "collapsed", but IIUC, the reproducer is effectively; docker login some-registry.example.com/repository/name
...
docker login some-registry.example.com/other-repository/name
... The problem looks to be that 27.2 is not converting the given registry to its hostname, and instead preserves the path (repository name), therefore storing each under a different key; echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com
# ...
Login Succeeded
echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com/repository/name
# ...
Login Succeeded
echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com/other-repository/name
# ...
Login Succeeded
cat ~/.docker/config.json
{
"auths": {
"registry.hub.docker.com": {
"auth": "<REDACTED>"
},
"registry.hub.docker.com/other-repository/name": {
"auth": "<REDACTED>"
},
"registry.hub.docker.com/repository/name": {
"auth": "<REDACTED>"
}
}
} doing the same with 27.1; echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com
# ...
Login Succeeded
echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com/repository/name
# ...
Login Succeeded
echo $PASS | docker login -u <USERNAME> --password-stdin registry.hub.docker.com/other-repository/name
# ...
Login Succeeded
cat ~/.docker/config.json
{
"auths": {
"registry.hub.docker.com": {
"auth": "<REDACTED>"
}
}
} |
cc @laurazard PTAL - looks like somewhere we're missing a call to cli/cli/config/credentials/file_store.go Line 95 in 6273e65
(Wondering if this is actually the underlying issue related to #5378, and not the hostname that's used 🤔 ) |
Re: #5378, I'm fairly certain it's a separate thing, because as I wrote there even in v27.1.2 if you only have credentials for I see where this issue was introduced though. |
FYI @thiago-gitlab, running |
Thank you for letting me know, @laurazard. We'll fix that on our scripts and any user documentation. And also thanks everyone for the amazingly quick response and fix. 🚀 🎉 |
Description
In Docker 27.1.2, running
docker login
multiple times causes the authentication information in~/.docker/config.json
to be updated with the latest successful execution.In 27.2.0, the first successful authentication prevents
config.json
from being updated.This is a breaking change because the existing expectation is that
docker login
always overwrites the authentication information.Reproduce
The push will fail since the authentication information recorded is for
repository-a
.I've reproduced this in https://gitlab.com/gitlab-org/gitlab/-/issues/481917#note_2081566814 by removing
config.json
before performing the second authentication.Expected behavior
docker login
always updatesconfig.json
with the successful authentication credentials.docker version
docker info
Additional Info
https://gitlab.com/gitlab-org/gitlab/-/issues/481917
The text was updated successfully, but these errors were encountered: