"no token in bearer response:" when building image with kaniko
Summary
I wanted to try kaniko
as described here https://docs.gitlab.com/ee/ci/docker/using_kaniko.html.
I am running GitLab 11.2.1 with GitLab Runner 11.2.0
.gitlab-ci.yml
stages:
- build
build_image:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /root/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
At the end of the build I get:
time="2018-08-27T14:39:34Z" level=info msg="cmd: ENTRYPOINT"
time="2018-08-27T14:39:34Z" level=info msg="Replacing Entrypoint in config with [/etc/nginx/run.sh]"
time="2018-08-27T14:39:34Z" level=info msg="No files changed in this command, skipping snapshotting."
time="2018-08-27T14:39:34Z" level=info msg="No files were changed, appending empty layer to config. No layer added to image."
Error: failed to push to destination registry.my.company/myproject/frontend:: no token in bearer response:
{"errors":[{"code":"DENIED","message":"access forbidden"}],"http_status":403}
What is the current bug behavior?
kaniko is not capable of pushing built images to the GitLab Docker Registry.
What is the expected correct behavior?
kaniko must be able to push images.
What may cause this issue?
Edited by Crunchtime Ali