GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.68k stars 1.43k forks source link

Kaniko with Tekton Pipeline: Nexus Registry Push Error "404 Not Found" #3198

Open omeracik49 opened 3 months ago

omeracik49 commented 3 months ago

I work at a corporate company where our network is intranet-based. We are using Nexus as our Docker registry and I am writing a pipeline in Tekton. In the pipeline, I am using Kaniko and have created the necessary config.json for Kaniko. However, when running the pipeline, I encounter the following error:

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 "nexus.example.com/project-name:image-tag": creating push check transport for nexus.example.com failed: GET https://nexus.example.com/v2/: unexpected status code 404 Not Found

Here are the YAML configurations for the volume and Kaniko:

volumes:
  - name: nexus-secret
    secret:
      items:
      - key: .dockerconfigjson
        path: config.json
      secretName: nexus

steps:
  - name: build-sources
    image: gcr.io/kaniko-project/executor:latest
    workingDir: /workspace/source/$(params.project-name)
    volumeMounts:
    - name: nexus-secret
      mountPath: /kaniko/.docker
    - name: kaniko-ssl
      mountPath: /kaniko/ssl/certs
    env:
    - name: DOCKER_CONFIG
      value: /kaniko/.docker
    command:
    - /kaniko/executor
    args:
    - --dockerfile=/workspace/source/$(params.project-name)/Dockerfile
    - --context=/workspace/source/$(params.project-name)
    - --destination=$(params.nexus-url)/$(params.project-name):$(params.image-tag)
    - --verbosity=debug

The config.json file was created using the following commands and contains:

{
  "auths": {
    "nexus.example.com": {
      "username": "my-username",
      "password": "my-password"
    }
  }
}

What I have tried:

Ensured that the config.json is correctly created and that I have the necessary permissions on Nexus.

Manually verified that the Nexus URL is correct.

Verified that Kaniko is correctly configured and that the necessary SSL certificates are present.

Problem: I am looking for a solution to this error and guidance on how to successfully push to the Nexus Registry using Kaniko. Can anyone help?