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 not able to auth against Nexus OSS #3099

Closed
JanHuege opened this issue Apr 4, 2024 · 2 comments
Closed

Kaniko not able to auth against Nexus OSS #3099

JanHuege opened this issue Apr 4, 2024 · 2 comments

Comments

@JanHuege
Copy link

JanHuege commented Apr 4, 2024

Actual behavior
Kaniko fails to auth against nexus while running in gitlab-ci

Kaniko-image: gcr.io/kaniko-project/executor:v1.14.0-debug
Nexus OSS Version: OSS 3.49.0-02

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 "private.registry.com/repository/imagename:tag": creating push check transport for 
private.registry.com failed: GET https://private.registry.com/v2/: unexpected status code 404 Not Found: 
...[html]...

Expected behavior
Login should work. Docker login/push all works with v2

To Reproduce
Steps to reproduce the behavior:

  1. Gitlab CI yml
    - echo "{\"auths\":{\"private.registry.com":{\"auth\":\"$NEXUS_DEPLOY_USER_PW_BASE64\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor
      --context "${CI_PROJECT_DIR}/frontend"
      --dockerfile "${CI_PROJECT_DIR}/frontend/Dockerfile.app-builder"
      --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA
      --build-arg=CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
      --build-arg=CI_COMMIT_TAG=$CI_COMMIT_TAG
      --destination "$BASE_URL/app-ui:$APP_VERSION"
      --destination "$BASE_URL/app-ui:$BRANCH_TAG"
      --destination "$BASE_URL/app-ui"

  1. run ci job
  2. fails at 'checking push permission'

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
@JanHuege
Copy link
Author

JanHuege commented Apr 5, 2024

Reproduction:

Dockerfile

FROM gcr.io/kaniko-project/executor:v1.14.0-debug

ADD Dockerfile.test Dockerfile.test

ARG REGISTRY_URL=[YOUR_NEXUS_URL]/repository/dockercontainer
ARG REGISTRY_USER=[your credential]
ARG REGISTRY_PASSWORD=[your credential]

RUN echo "{\"auths\":{\"$REGISTRY_URL\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
RUN /kaniko/executor --context "." --dockerfile "Dockerfile.test" --destination "${REGISTRY_URL}/test:latest"
CMD [ "echo", "Hello World" ]

Dockerfile.test

FROM alpine:latest
CMD [ "echo", "Hello World" ]

Folderstructure

kaniko
  |__ Dockerfile
  |__ Dockerfile.test

Inside kaniko Folder:
docker build .

@JanHuege
Copy link
Author

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

No branches or pull requests

1 participant