I am trying to push a docker image to Artifact Registry however I get error status 400 Bad Request:
code: "UNAUTHORIZED"
message: "not authenticated: No valid credential was supplied"
I assume this means that my authentication credentials for Google Artifact Registry are either missing or incorrect.
I am working from the owner account and should have correct credentials to push to the repository. What I've done so far:
- logged in with
gcloud auth login
successfully - set
gcloud auth configure-docker me-west1-docker.pkg.dev
which is reflected in.docker/config.json
file (seen below) - added
Artifact Registry Administrator
andArtifact Registry Writer
permission to my account (owner) - attempted different authentication alternatives inlcuding (1) configured Docker authentication with
gcloud auth configure-docker
and (2) followed Configure authentication to Artifact Registry for Docker using the access token authentication method after which I still was unable to push to Artifact Registry
Here is my .docker/config.json file
{
"auths": {
"/": {},
";: {},
"me-west1-docker.pkg.dev": {}
},
"credsStore": "desktop",
"credHelpers": {
"asia.gcr.io": "gcloud",
"eu.gcr.io": "gcloud",
"gcr.io": "gcloud",
"marketplace.gcr.io": "gcloud",
"me-west1-docker.pkg.dev": "gcloud",
"staging-k8s.gcr.io": "gcloud",
"us.gcr.io": "gcloud"
},
"currentContext": "desktop-linux",
"plugins": {
"-x-cli-hints": {
"enabled": "true"
}
},
"features": {
"hooks": "true"
}
}%
Aside from that, I'm not sure how to proceed to add authentication on the client side.
I am trying to push a docker image to Artifact Registry however I get error status 400 Bad Request:
code: "UNAUTHORIZED"
message: "not authenticated: No valid credential was supplied"
I assume this means that my authentication credentials for Google Artifact Registry are either missing or incorrect.
I am working from the owner account and should have correct credentials to push to the repository. What I've done so far:
- logged in with
gcloud auth login
successfully - set
gcloud auth configure-docker me-west1-docker.pkg.dev
which is reflected in.docker/config.json
file (seen below) - added
Artifact Registry Administrator
andArtifact Registry Writer
permission to my account (owner) - attempted different authentication alternatives inlcuding (1) configured Docker authentication with
gcloud auth configure-docker
and (2) followed Configure authentication to Artifact Registry for Docker using the access token authentication method after which I still was unable to push to Artifact Registry
Here is my .docker/config.json file
{
"auths": {
"https://index.docker.io/v1/": {},
"https://index.docker.io/v1/refresh-token": {},
"me-west1-docker.pkg.dev": {}
},
"credsStore": "desktop",
"credHelpers": {
"asia.gcr.io": "gcloud",
"eu.gcr.io": "gcloud",
"gcr.io": "gcloud",
"marketplace.gcr.io": "gcloud",
"me-west1-docker.pkg.dev": "gcloud",
"staging-k8s.gcr.io": "gcloud",
"us.gcr.io": "gcloud"
},
"currentContext": "desktop-linux",
"plugins": {
"-x-cli-hints": {
"enabled": "true"
}
},
"features": {
"hooks": "true"
}
}%
Aside from that, I'm not sure how to proceed to add authentication on the client side.
Share Improve this question edited Feb 4 at 9:41 noor soreti asked Feb 3 at 16:13 noor soretinoor soreti 416 bronze badges 7 | Show 2 more comments1 Answer
Reset to default 0I think I found the issue. It seems there may be conflicting settings in your config.json
file.
Based from this documentation:
When Docker connects to a registry, it checks first for a credential helper that is associated with the host. So if your
config.json
includes Artifact Registry settings in both thecredHelpers
andauths
sections, the settings in theauths
section are ignored.
If you already have a credential helper configured for a registry in the credHelpers
section, you can attempt to simply remove the corresponding entry in the auths
section for that registry. For example, you can modify it as follows and check if it works:
{
"auths": {
"https://index.docker.io/v1/": {},
"https://index.docker.io/v1/refresh-token": {},
},
"credsStore": "desktop",
"credHelpers": {
"asia.gcr.io": "gcloud",
"eu.gcr.io": "gcloud",
"gcr.io": "gcloud",
"marketplace.gcr.io": "gcloud",
"me-west1-docker.pkg.dev": "gcloud",
"staging-k8s.gcr.io": "gcloud",
"us.gcr.io": "gcloud"
},
}%
Hope this helps.
config.json
? – DazWilkin Commented Feb 3 at 19:29gcloud auth login
. – HerPat Commented Feb 3 at 22:36sudo gcloud auth login
? If you usesudo
with Docker, Docker will look for credentials in the root directory. If you didn't usesudo
for the authentication login, it won't find the credentials there. – HerPat Commented Feb 4 at 13:37