Open alezzandro opened 5 years ago
I think that you missed to mount the secret created for the service account within the pod running kaniko
. So this file /builder/home/.docker/docker.json
is probably not mounted with the credentials to access the docker registry.
I'm also experimenting the same issue even if the ENV VAR - DOCKER_CONFIG
is set correctly and pointto the file
/builder/home/.docker/config.json` which is well there
{"auths":{"172.30.4.187:5000":{"username":"serviceaccount","password":"eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJ0ZXN0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImJ1aWxkLWJvdC10b2tlbi1zNHgycyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJidWlsZC1ib3QiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI4ZDY4YjNlZi1kNjFjLTExZTktYmJkOS0xMDdiNDRiMDM1NDAiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6dGVzdDpidWlsZC1ib3QifQ.usmzIiQGht96VcI9Ut6tTejw40imn0htKWymU4qbSW6tgga0R1k9XV41r-C8YMawHC37UKUOgO500IMB5WHTMyPoBJ7QzpDR2T5PCn0_TbzxcziKDI_1F23TmlZfzALcRB1OuzG2NwkpCDTcZ8MvIIRVVPZsEdnT2lDDtKhAvh_t9BA2wGay1SrssGI7dL2e1AGcDpMkgvGrvTCp8qNNmVuDq0nXvDPmgWIyRYrA6m5tnv50dfLM5p6xOObKhdIHXmfHw6V8k4KFqdiSWgY-eA-jscr3kRIgURqpEBNorcCJzgVruwwF66RJ0EVJC0ZsNhWTUzKcopUT3bGT7TdteA","auth":"c2VydmljZWFjY291bnQ6ZXlKaGJHY2lPaUpTVXpJM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zBac05oV1RVektjb3BVVDNiR1Q3VGR0ZUE=","email":"serviceaccount@example.org"},"docker-registry.default.svc.cluster.local:5000":{"username":"serviceaccount","password":"eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJ0ZXN0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImJ1aWxkLWJvdC10b2tlbi1zNHgycyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJidWlsZC1ib3QiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI4ZDY4YjNlZi1kNjFjLTExZTktYmJkOS0xMDdiNDRiMDM1NDAiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6dGVzdDpidWlsZC1ib3QifQ.usmzIiQGht96VcI9Ut6tTejw40imn0htKWymU4qbSW6tgga0R1k9XV41r-C8YMawHC37UKUOgO500IMB5WHTMyPoBJ7QzpDR2T5PCn0_TbzxcziKDI_1F23TmlZfzALcRB1OuzG2NwkpCDTcZ8MvIIRVVPZsEdnT2lDDtKhAvh_t9BA2wGay1SrssGI7dL2e1AGcDpMkgvGrvTCp8qNNmVuDq0nXvDPmgWIyRYrA6m5tnv50dfLM5p6xOObKhdIHXmfHw6V8k4KFqdiSWgY-eA-jscr3kRIgURqpEBNorcCJzgVruwwF66RJ0EVJC0ZsNhWTUzKcopUT3bGT7TdteA","auth":"c2VydmljZWFjY291bnQ6ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklpSjkuZXlKcGMzTWlPaUpyZFdKbGNtNWxkR1Z6TDNObGNuWnBZMlZoWTJOdmRXNTBJaXdpYTNWaVpYSnVaWFJsY3k1cGJ5OXpaWEoyYVdObFlXTmpiM1Z1ZEM5dVlXMWxjM0JoWTJVaU9pSjBaWE4wSWl3aWEzVmlaWEp1WlhSbGN5NXBieTl6WlhKMmFXTmxZV05qYjNWdWRDOXpaV055WlhRdWJtRnRaU0k2SW1KMWFXeGtMV0p2ZEMxMGIydGxiaTF6TkhneWN5SXNJbXQxWW1WeWJtVjBaWE11YVc4dmMyVnlkbWxqWldGalkyOTFiblF2YzJWeWRtbGpaUzFoWTJOdmRXNTBMbTVoYldVaU9pSmlkV2xzWkMxaWIzUWlMQ0pyZFdKbGNtNWxkR1Z6TG1sdkwzTmxjblpwWTJWaFkyTnZkVzUwTDNObGNuWnBZMlV0WVdOamIzVnVkQzUxYVdRaU9pSTRaRFk0WWpObFppMWtOakZqTFRFeFpUa3RZbUprT1MweE1EZGlORFJpTURNMU5EQWlMQ0p6ZFdJaU9pSnplWE4wWlcwNmMyVnlkbWxqWldGalkyOTFiblE2ZEdWemREcGlkV2xzWkMxaWIzUWlmUS51c216SWlRR2h0OTZWY0k5VXQ2dFRlanc0MGltbjBodEtXeW1VNHFiU1c2dGdnYTBSMWs5WFY0MXItQzhZTWF3SEMzN1VLVU9nTzUwMElNQjVXSFRNeVBvQko3UXpwRFIyVDVQQ24wX1RienhjemlLRElfMUYyM1RtbFpmekFMY1JCMU91ekcyTndrcENEVGNaOE12SUlSVlZQWnNFZG5UMmxERHRLaEF2aF90OUJBMndHYXkxU3Jzc0dJN2RMMmUxQUdjRHBNa2d2R3J2VENwOHFOTm1WdURxMG5YdkRQbWdXSXlSWXJBNm01dG52NTBkZkxNNXA2eE9PYktoZElIWG1mSHc2VjhrNEtGcWRpU1dnWS1lQS1qc2NyM2tSSWdVUnFwRUJOb3JjQ0p6Z1ZydXd3RjY2UkowRVZKQzBac05oV1RVektjb3BVVDNiR1Q3VGR0ZUE=","email":"serviceaccount@example.org"},"docker-registry.default.svc:5000":{"username":"serviceaccount","password":"eyJhbGciOiJSUzI1Ni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6WlhKMmFXTmxZV05qYjNWdWRDOXpaV055WlhRdWJtRnRaU0k2SW1KMWFXeGtMV0p2ZEMxMGIydGxiaTF6TkhneWN5SXNJbXQxWW1WeWJtVjBaWE11YVc4dmMyVnlkbWxqWldGalkyOTFiblF2YzJWeWRtbGpaUzFoWTJOdmRXNTBMbTVoYldVaU9pSmlkV2xzWkMxaWIzUWlMQ0pyZFdKbGNtNWxkR1Z6TG1sdkwzTmxjblpwWTJWaFkyTnZkVzUwTDNObGNuWnBZMlV0WVdOamIzVnVkQzUxYVdRaU9pSTRaRFk0WWpObFppMWtOakZqTFRFeFpUa3RZbUprT1MweE1EZGlORFJpTURNMU5EQWlMQ0p6ZFdJaU9pSnplWE4wWlcwNmMyVnlkbWxqWldGalkyOTFiblE2ZEdWemREcGlkV2xzWkMxaWIzUWlmUS51c216SWlRR2h0OTZWY0k5VXQ2dFRlanc0MGltbjBodEtXeW1VNHFiU1c2dGdnYTBSMWs5WFY0MXItQzhZTWF3SEMzN1VLVU9nTzUwMElNQjVXSFRNeVBvQko3UXpwRFIyVDVQQ24wX1RienhjemlLRElfMUYyM1RtbFpmekFMY1JCMU91ekcyTndrcENEVGNaOE12SUlSVlZQWnNFZG5UMmxERHRLaEF2aF90OUJBMndHYXkxU3Jzc0dJN2RMMmUxQUdjRHBNa2d2R3J2VENwOHFOTm1WdURxMG5YdkRQbWdXSXlSWXJBNm01dG52NTBkZkxNNXA2eE9PYktoZElIWG1mSHc2VjhrNEtGcWRpU1dnWS1lQS1qc2NyM2tSSWdVUnFwRUJOb3JjQ0p6Z1ZydXd3RjY2UkowRVZKQzBac05oV1RVektjb3BVVDNiR1Q3VGR0ZUE=","email":"serviceaccount@example.org"}}}%
But kaniko - gcr.io/kaniko-project/executor:v0.9.0, when it will try to push the image is complaining
2019/09/13 11:51:53 Unable to read "/home/builder/.docker/config.json": open /home/builder/.docker/config.json: no such file or directory
This message is returned from this code : https://github.com/GoogleContainerTools/kaniko/blob/80421f2a73d49057ab0aea8170afbf867475855c/vendor/github.com/google/go-containerregistry/pkg/authn/keychain.go#L106-L111
So it seems that when kaniko container runs, then it can't find the file /home/builder/.docker/config.json
Here is the snippet part of the pod created by tekton
- args:
- '-wait_file'
- /builder/tools/2
- '-post_file'
- /builder/tools/3
- '-entrypoint'
- /kaniko/executor
- '--'
- '--dockerfile=./Dockerfile'
- '--skip-tls-verify'
- '--context=/workspace/source/./'
- '--destination=docker-registry.default.svc:5000/test/sb-kaniko-image'
command:
- /builder/tools/entrypoint
env:
- name: HOME
value: /builder/home
- name: DOCKER_CONFIG
value: /home/builder/.docker
image: 'gcr.io/kaniko-project/executor:v0.9.0'
imagePullPolicy: IfNotPresent
name: step-build-and-push
resources:
requests:
cpu: '0'
ephemeral-storage: '0'
memory: '0'
securityContext:
capabilities:
drop:
- MKNOD
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /builder/tools
name: tools
- mountPath: /workspace
name: workspace
- mountPath: /builder/home
name: home
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: build-bot-token-trx47
readOnly: true
workingDir: /workspace/source
volumes:
- emptyDir: {}
name: home
Actual behavior It seems that kaniko is trying to use the latest metadata "FROM registry.fedoraproject.org/fedora-minimal" in the Dockerfile:
To Reproduce I'm testing quarkus project with Knative in OpenShift (Kubernetes) with following Dockerfile. https://github.com/quarkusio/quarkus-quickstarts/tree/master/getting-started-knative
Kaniko image used (current latest):
Pod info: