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

Kaniko multi-stage dockerfile build issue #2835

Open
harshadjoshi619 opened this issue Nov 7, 2023 · 5 comments
Open

Kaniko multi-stage dockerfile build issue #2835

harshadjoshi619 opened this issue Nov 7, 2023 · 5 comments
Labels
area/authentication issue/push-fails kind/bug Something isn't working priority/p2 High impact feature/bug. Will get a lot of users happy registry/artifactory

Comments

@harshadjoshi619
Copy link

Actual behavior
I am using kaniko-project/executor:v1.17.0-slim in my tekton pipeline. In case of normal dockerfiles it is working as expected but when we try with multi-stage dockerfiles it is giving me below error:

error pushing image: failed to push to destination ".../.../" UNAUTHORISED user is unauthorised to upload to ".../.../"

Expected behavior
Kaniko should upload multi-stage dockerfile image to artifactory

To Reproduce
Steps to reproduce the behavior:

  1. create a dockerfile with multiple FROM statements in it
  2. use kaniko version as kaniko-project/executor:v1.17.0-slim

Additional Information

I am already using /kaniko/.docker to store my credentials. Still facing same issue.

Kindly suggest some way to overcome this issue.

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
@aaron-prindle aaron-prindle added area/authentication priority/p2 High impact feature/bug. Will get a lot of users happy issue/push-fails kind/bug Something isn't working registry/artifactory labels Nov 10, 2023
@aaron-prindle
Copy link
Collaborator

aaron-prindle commented Nov 10, 2023

@harshadjoshi619 thanks for flagging this issue. To help debug this, can you post the entire logs from the failing run (with any sensitive info redacted), preferably running with verbose logs - eg: --verbosity=debug. If you have a small repro docker file/repro-project that would be helpful as well. Currently I am a bit confused if the issue here is referring to kaniko not being able to push multi-stage images to JFrog Artifactory or if kaniko is not able to pull down intermediate FROM images in a multi-stage build from JFrog Artifactory

@frami
Copy link

frami commented Nov 20, 2023

I have the same problem. I found out, that kaniko deletes the docker configuration file in /root/.docker. I think it's the same issue as #2764

@atorrembo
Copy link

Maybe related to #2576 ?

@zijiwork
Copy link

What progress has been made

@mzihlmann
Copy link

kaniko removes everything outside of the /kaniko dir when switching over to the second build stage, so if your credentials are stored outside this directory they are indeed gone. You can safe a file across boundaries by putting it on the ingore list:
https://github.com/GoogleContainerTools/kaniko#flag---ignore-path

--ignore-path=/root/.netrc

as an example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/authentication issue/push-fails kind/bug Something isn't working priority/p2 High impact feature/bug. Will get a lot of users happy registry/artifactory
Projects
None yet
Development

No branches or pull requests

6 participants