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

Missing '.docker' folder in release 0.20.0 break backward compatibility in some pipelines #1227

Closed
arum31 opened this issue May 4, 2020 · 7 comments · Fixed by #1230
Closed

Comments

@arum31
Copy link

arum31 commented May 4, 2020

Actual behavior
My CI/CD (gitlab) image build job looks like this:

  image:
    name: gcr.io/kaniko-project/executor:debug-v0.20.0
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"gitlab-ci-token\",\"password\":\"${API_KEY}\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/docker/Dockerfile --destination ${IMAGE_NAME}

This raises an error during the config file creation:

 echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"_\",\"password\":\"${API_KEY}\"}}}" > /kaniko/.docker/config.json
/busybox/sh: eval: line 91: can't create /kaniko/.docker/config.json: nonexistent directory

After entering the image there is no /kaniko/.docker folder as expected (as of v0.19.0).

Tested with:
gcr.io/kaniko-project/executor:debug-v0.19.0
gcr.io/kaniko-project/executor:debug-v0.20.0

Expected behavior
/kaniko/.docker folder exists.

To reproduce
Steps to reproduce the behavior:

  1. docker run -it --rm --entrypoint="" gcr.io/kaniko-project/executor:debug-v0.19.0 sh
  2. ls -ail /kaniko
  3. A folder .docker should exist
  4. Run into v0.20.0: docker run -it --rm --entrypoint="" gcr.io/kaniko-project/executor:debug-v0.20.0 sh
  5. After a ls -ail /kaniko you should note there is no more .docker folder
@gfvirga
Copy link
Contributor

gfvirga commented May 4, 2020

Is the new procedure on v0.20.0? Gitlab runners don't automount .docker

@gajus
Copy link

gajus commented May 4, 2020

@gfvirga You can just update your script to create the directory.

script:
  # @see https://github.com/GoogleContainerTools/kaniko/issues/1227
  - mkdir -p /kaniko/.docker
  - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
  - /kaniko/executor --build-arg=NPM_TOKEN --cache=true --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_PIPELINE_ID.$CI_COMMIT_SHA

but yes, this is a breaking change.

@kolikons
Copy link

kolikons commented May 5, 2020

also, if the command for auth is using them error apprises like that

/kaniko # docker-credential-acr
Error creating credential store helper: Failed to create secondary file store dir /kaniko/.docker/acr```

@D3N14L
Copy link
Contributor

D3N14L commented May 5, 2020

The official GitLab documentation shows an example that is broken since v0.20.0.
https://docs.gitlab.com/ee/ci/docker/using_kaniko.html#building-a-docker-image-with-kaniko

I opened a pull-request that should fix that.

tejal29 added a commit that referenced this issue May 6, 2020
Fixes #1227 - Readded the /kaniko/.docker directory
@webmutation
Copy link

So to be clear the official fix for this is to create the directory? This will not be fixed with v0.21.0 ?
Seems a bit counter intuitive but ok

@arum31
Copy link
Author

arum31 commented May 6, 2020

@webmutation: as far as I understand the MR #1230 has re-added the folder by default. Probably the 0.21.0 will again have the /kaniko/.docker folder.

@webmutation
Copy link

Ok. I saw the commit. I did not notice it was already released. Thanks for the fb

no-reply pushed a commit to surfliner/surfliner-mirror that referenced this issue May 9, 2020
- Also ensure `/docker/.kaniko` directory exists
- see: GoogleContainerTools/kaniko#1227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants