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

Build and push to DockerHub UNAUTHORIZED: authentication required #3273

Open
tbernacchi opened this issue Jul 31, 2024 Discussed in #3272 · 2 comments
Open

Build and push to DockerHub UNAUTHORIZED: authentication required #3273

tbernacchi opened this issue Jul 31, 2024 Discussed in #3272 · 2 comments

Comments

@tbernacchi
Copy link

Discussed in #3272

Originally posted by tbernacchi July 31, 2024
I'm new with kaniko, I ended up here because I was trying to build a pipeline with argo and one the steps I got the message that docker not found. Which it makes sense since my kubernetes cluster was build with containerd as a CRI. Now I'm trying to build a simple image using kaniko and I can't make it work. This is the .yaml file I'm using to try to build a Docker image and send to Docker registry.

---
apiVersion: v1
kind: Pod
metadata:
  name: kaniko
  namespace: fibonacci
spec:
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:v1.23.1
    args: ["--dockerfile=/Dockerfile/Dockerfile", "--context=/workspace", "--destination=tadeuuuuu/fibonacci:v0.1.6"]
    volumeMounts:
      - name: dockerfile
        mountPath: /Dockerfile
      - name: kaniko-secret
        mountPath: /kaniko/.docker/
        readOnly: true
  restartPolicy: Never
  volumes:
    - name: dockerfile
      configMap:
        name: dockerfile-config
    - name: kaniko-secret
      secret:
        secretName: docker-registry-secret

For docker-registry-secret I've followed these steps:

kubectl create secret docker-registry docker-registry-secret --from-file=.dockerconfigjson=config.json -n fibonacci

My config.json:

{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "MY-TOKEN-FROM-DOCKERHUB"
    }
  }
}
k create -f kaniko-test.yaml
pod/kaniko created

k get pods -n fibonacci | grep -i kaniko
kaniko                                            0/1     Error    0          15m

k logs pod/kaniko -n fibonacci
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 "tadeuuuuu/fibonacci:v0.1.6": POST https://index.docker.io/v2/tadeuuuuu/fibonacci/blobs/uploads/: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:tadeuuuuu/fibonacci Type:repository] map[Action:push Class: Name:tadeuuuuu/fibonacci Type:repository]]

Any ideas what I'm missing? Any help will be appreciate! Thank you

@tkoeppen
Copy link

tkoeppen commented Aug 5, 2024

you can use image: gcr.io/kaniko-project/executor:v1.23.2-debug instead of image: gcr.io/kaniko-project/executor:v1.23.2
to see more info why it failed.

eventually, also add "--verbosity debug" to the args in case above does not show enough info

https://github.com/GoogleContainerTools/kaniko?tab=readme-ov-file#flag---verbosity

@arash87
Copy link

arash87 commented Sep 13, 2024

I recommend using a username and password instead of auth, as Docker Desktop (at least locally) doesn't seem to work with auth.

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

3 participants