kaniko: Pushing images to dockerhub stopped working
Actual behavior
Kaniko exits with exit code 1 with the following message and and does not build the image:
error checking push permissions -- make sure you entered the correct tag name,
and that you are authenticated correctly, and try again: checking push permission for
"foo/bar:bionic-99": UNAUTHORIZED: authentication required; [map[Action:pull Class:
Name:mgit/clamav Type:repository] map[Action:push Class: Name:foo/bar Type:repository]]
This worked with the same build pipeline and no changes 3 months ago with the following image:
Using Docker executor with image gcr.io/kaniko-project/executor:debug ...
Pulling docker image gcr.io/kaniko-project/executor:debug ...
Using docker image sha256:2aa254b4837c242c7de87956438eaba70f97a2768ab0870819fd20e09df15cf6 for gcr.io/kaniko-project/executor:debug ...
Expected behavior
Kaniko to upload image to dockerhub like the version 3 months ago was able to. There where no changes, and it works if i go back to an older kaniko version.
To Reproduce Steps to reproduce the behavior:
- … with the following pseudo .gitlab-ci.yml
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stages:
- foo
build-foo:
stage: foo
script:
- echo "{\"auths\":{\"index.docker.io\":{\"auth\":\"${CI_DOCKERHUB_AUTH}\"}}}" > /kaniko/.docker/config.json
- >
/kaniko/executor --context "${CI_PROJECT_DIR}/foo" --dockerfile "${CI_PROJECT_DIR}/foo/Dockerfile"
--destination foo/bar:blub-${CI_PIPELINE_IID}"
--destination foo/bar:blub"
- … build it
Additional Information
- Dockerfile Please provide either the Dockerfile you’re trying to build or one that can reproduce this error.
- Build Context Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands)
- Kaniko Image (fully qualified with digest)
Using Docker executor with image gcr.io/kaniko-project/executor:debug ...
Pulling docker image gcr.io/kaniko-project/executor:debug ...
Using docker image sha256:2ec307dcf7f52dcf700ea0fbc65d448f46365cfac69567e8177bf12b80942f54 for gcr.io/kaniko-project/executor:debug ...
Triage Notes for the Maintainers
| Description | Yes/No |
|---|---|
| Please check if this a new feature you are proposing |
|
| Please check if the build works in docker but not in kaniko |
|
Please check if this error is seen when you use --cache flag |
|
| Please check if your dockerfile is a multistage dockerfile |
|
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 24
- Comments: 45 (4 by maintainers)
Commits related to this issue
- Try pinning kaniko version. See https://github.com/GoogleContainerTools/kaniko/issues/1209 — committed to brianseeders/kibana-ci-service by brianseeders 4 years ago
- [CI-116]: Fix version of Kaniko to 0.16.0. We need to fix versions of third party images that we use to ensure consistency. One issue that is present in subsequent releases is https://github.com/Googl... — committed to harness/harness-core by vistaarjuneja 4 years ago
- [CI-116]: Fix version of Kaniko to 0.16.0. (#15053) * [CI-116]: Fix version of Kaniko to 0.16.0. We need to fix versions of third party images that we use to ensure consistency. One issue that is p... — committed to harness/harness-core by vistaarjuneja 4 years ago
- Handle issue with GoogleContainerTools/kaniko#1209 To get around GoogleContainerTools/kaniko#1209 we need to auth using the DockerHub v1 API. As that variable is the "registry" and we have to use a F... — committed to drGrove/drone-kaniko by drGrove 3 years ago
- Handle issue with GoogleContainerTools/kaniko#1209 To get around GoogleContainerTools/kaniko#1209 we need to auth using the DockerHub v1 API. As that variable is the "registry" and we have to use a F... — committed to drGrove/drone-kaniko by drGrove 3 years ago
- workaround (yet another) kaniko-related issue Kaniko does (no longer?) seem to support authenticating against "docker-hub"'s v2-api-endpoint, as also discussed on GitHub: https://github.com/GoogleCo... — committed to gardener/cc-utils by ccwienk 3 years ago
We are using Harbor as a self hosted container registry, but I cannot get the authentification to work in the kaniko build. The error is the same as with the official Docker registry:
I also tried the suggested workaround resulting in
config.jsonlike this:But the logs/errors stayed the same, i.e. Kaniko still used the
https://hub.domain.com/v2/endpoint. Any hints how I could adapt the workaround to work with Harbor as well?This seems to work for docker hub :
+1. I am able to upload docker images with https://index.docker.io/v1 but not https://index.docker.io/v2 with the latest kaniko debug executor image. Is anyone working on this issue?
i can verify that for us too the lastest working kaniko version is
v0.16.0v0.20.0is not able to build the image, with the following job output:thanks @ymage. I was using the v2 docker endpoint instead of v1.
I tried to use https://index.docker.io/v1/ instead of v2 one as docker registry url, which seemed to work for me. Is v2 endpoint really suported by kaniko ?
In the known issues section in readme, it is mentioned that Kanika does not support v1 api https://github.com/GoogleContainerTools/kaniko#known-issues. These are contradictory items in the document.
OK the doc is https://github.com/GoogleContainerTools/kaniko#pushing-to-docker-hub
Use a
config.jsonfile for docker as:After hours upon hours on this issue and keep getting the Unauthorized error, I did a
docker loginand found that the config looked as follows:When doing a
base64 -don both, it showed the same value. Thus the issue was thatdocker loginuses a differentbase64encode method forv1andv2. (my password ended with an=) When using Kaniko I removed thev2auth and it now works.@nlamirault how did you changed the v1/v2 endpoint for reaching dockerhub ?
I don’t understand why it’s so complicated to have this basic feature working… (I’m just starting with Kaniko…)
works for me:
UP. It seems the real reason was UserAgent in config.json:
After removing this section I haven’t have any problems with pushing (even with original debug-539ddefcae3fd6b411a95982a830d987f4214251)
This is also happening to us using the lastest version of “debug” (May 6, 2020) attempting to push to GCR. Seeing this error:
Changing to tag
debug-v0.19.0things start working again.I’m having the exact same problem, did you ever find the fix to this?
Ok sooo, since v1 is deprecated, I don’t believe using v1 is the safe option here or is it? I’m just confused. Isn’t v1 supported only by older docker clients? (and thus meaning it would stop working someday)
Which makes me think that, from debug-v0.16.0 to debug-v0.19.0 something change that made the registries think kaniko is an old docker client? and thus blocking kaniko from pushing/pulling on v2? I don’t know.
Does kaniko actually supports docker registry v2 API? I have private registry with v2 api exposed and cannot pull images from there by their tags (e.g. latest / stable / specific x.x.x version). Pull directly from docker command line works perfectly. Kaniko can only pull if I provide the exact image digest. Your docs at README.md says that v1 is not supported - so how to make this pull work with v2 API?
I try with Kaniko v1.0.0 on Docker Hub v2 endpoint, it fails. It works using v1.
After being struggled all the day with the issue, trying to push to dockerhub with a previous version of kaniko, debug-v0.18.0, which was fine few months ago in the same context, as @gebi, I was able to push the image using
--registry-mirror index.docker.io.@tejal29 may it be related to dockerhub hostname or default image path that has maybe changed and is no more compatible with kaniko (in old versions at least)?
I’m using
authswithhttps://index.docker.io/v1/inconfig.json.KO:
OK with
--registry-mirror index.docker.io:I confirm I did not face the problem with
debug-v1.0.0.And there i was sitting the last sunday half a day thinking to be that stupid to build a simple image which i wanted to push to my private docker hub.
auths: [https://index.docker.io/v**2**/]
auths: [https://index.docker.io/v**1**/]
What combination should i use, since i have no idea what the difference it’s making?
Version 0.22.0 fixed my issue.
@gebi thanks, I confirm with the
mgit/base:kaniko-executor-debug-stableimage I was able to push to DockerHub but withgcr.io/kaniko-project/executor:debugI was experiencing the same error. Thanks!This is my script
Used variables to make it more meaningful for newbies (like myself 1 hour ago)