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
fix issue, docker push in kaniko failed since permission error #706
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vincent-pli If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @vincent-pli. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -66,6 +66,9 @@ spec: | |||
- --dockerfile=${inputs.params.pathToDockerFile} | |||
- --destination=${outputs.resources.builtImage.url} | |||
- --context=${inputs.params.pathToContext} | |||
env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 interesting, this shouldn't be required as $HOME
should be /builder/home
and… it works on the CI :sweat_smile: cc @bobcatfish because I might overlook something 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue suffered me several hours, then I found this:
https://github.com/GoogleContainerTools/kaniko/issues/290
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm it might have something to do with what the default account in the namespace has permission to do (for example, mine always has permission to push to registries within the same project)
I think it makes sense that by default kaniko wouldn't be using anything in /builder/home/.docker/
For context @vincent-pli, were you providing a service account to this TaskRun when running it, or just running it with the default service account in the namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bobcatfish
I provide specific service account rather that default one, which include two secret, one for git another for docker.
By default, the kaniko try to find docker configuration file at /kaniko/.docker/config.json(the path define by env parameter: DOCKER_CONFIG), it's empty.
The "creds-init" just generate the file to /builder/home/.docker/
That's why I suggest to rewrite DOCKER_CONFIG in the task definition.
Thanks for the PR!! 🎉 Super quick note @vincent-pli , in the PR description, could you take a look at the checklist and make sure to check the items off (after making sure the PR complies with them ;) ):
(Some of the details that you have in the PR description would be great in the commit message as well!) |
@bobcatfish @vdemeester I find another evidence: https://github.com/knative/build-templates/tree/master/kaniko Please check it, thanks |
Interesting🤔, the embed url cannot open, always get 404, please copy and paste the url to address bar😅, thanks |
The same issue. So, Is there have any official solution for that.
|
/assign @bobcatfish |
@vincent-pli I think this mainly need to be fixed in the |
@vdemeester |
Discussed in tektoncd/pipeline#706 Fix tektoncd/pipeline#848 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
opened tektoncd/catalog#22 |
@akihikokuroda |
I can not take credit for this :-) it’s for you @AkihiroSuda |
lol 😄 |
😓 😓 😓 😓 😓 😓 |
Discussed in tektoncd/pipeline#706 Fix tektoncd/pipeline#848 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
tektoncd/catalog#22 is merged, I think we can close this one 👼 |
@vdemeester: Closing this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Why? The example in this PR seems independent from the kaniko catalog. |
Changes
I tried this example, at the step of "build-push-kaniko", it try to push image to docker.hub,
then hit permission error, seems it's not authorized to do that.
As we know, the "taskrun" will launch a "init container" to do that for us after set the "service account".
After some search, I find in "kaniko", it use a env parameter: DOCKER_CONFIG which point to ".docker/config.json". by default, the value is "/kaniko/.docker/".
As we know, the "taskrun" will put the docker authentication file at "/builder/home/.docker/"
So, to make the example work, need add additional config to rewrite the " DOCKER_CONFIG"
Submitter Checklist
examples/taskruns/taskrun.yaml
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide
for more details.
Release Notes