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

Reset ENTRYPOINT, run kaniko in CMD block #1651

Open
bittner opened this issue May 14, 2021 · 0 comments
Open

Reset ENTRYPOINT, run kaniko in CMD block #1651

bittner opened this issue May 14, 2021 · 0 comments
Labels
area/container For all bugs related to the kaniko container kind/enhancement New feature or request priority/p3 agreed that this would be good to have, but no one is available at the moment.

Comments

@bittner
Copy link

bittner commented May 14, 2021

Actual behavior

Kaniko executor as ENTRYPOINT makes it hard to use the image for CI pipelines (e.g. GitLab). You have to reconfigure the entrypoint to /bin/sh or reset its value using ENTRYPOINT [].

# Example .gitlab-ci.yml (note the `entrypoint` below), taken from 
# https://docs.gitlab.com/ee/ci/docker/using_kaniko.html#building-a-docker-image-with-kaniko
build:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
  - mkdir -p /kaniko/.docker
  - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
  - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG

Expected behavior

The image should be usable with CI systems such as GitLab CI or GitHub Actions out-of-the-box (e.g. use an entrypoint script, fall back to /bin/sh when that is overridden, only use CMD to run kaniko for convenience or don't run kaniko by default at all).

A resulting CI setup would be simpler, e.g.

build:
  stage: build
  image: gcr.io/kaniko-project/executor:debug
  script:
  - ...

To Reproduce

Steps to reproduce the behavior:

  1. Use the debug image with GitLab or GHA (e.g. image: gcr.io/kaniko-project/executor:default) without reconfiguring the entrypoint
  2. Run the pipeline -- it will fail
  3. Remove ENTRYPOINT and CMD (or set ENTRYPOINT [])
  4. Run the pipeline -- it will succeed

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 kind/enhancement New feature or request area/container For all bugs related to the kaniko container priority/p3 agreed that this would be good to have, but no one is available at the moment. labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container For all bugs related to the kaniko container kind/enhancement New feature or request priority/p3 agreed that this would be good to have, but no one is available at the moment.
Projects
None yet
Development

No branches or pull requests

2 participants