Second kaniko run in one CI job fails
Building two images with kaniko in one CI job fails with the error message:
symlink /bin/busybox /bin/arch: file exists
See this project:
https://gitlab.com/AndreKR/kaniko-test
It is two simple Dockerfiles (just FROM alpine:3.8 RUN echo) and this .gitlab-ci.yml:
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /root/.docker/
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"gitlab-ci-token\",\"password\":\"$CI_JOB_TOKEN\"}}}" > /root/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/a --dockerfile $CI_PROJECT_DIR/a/Dockerfile --destination $CI_REGISTRY_IMAGE:a
- /kaniko/executor --context $CI_PROJECT_DIR/b --dockerfile $CI_PROJECT_DIR/b/Dockerfile --destination $CI_REGISTRY_IMAGE:b
As you can see in https://gitlab.com/AndreKR/kaniko-test/-/jobs/91332676 the second kaniko run fails:
$ /kaniko/executor --context $CI_PROJECT_DIR/a --dockerfile $CI_PROJECT_DIR/a/Dockerfile --destination $CI_REGISTRY_IMAGE:a
ERROR: logging before flag.Parse: W0822 18:36:09.302179 9 metadata.go:250] Google container registry is disabled, no storage scope is available: ["https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write"]
time="2018-08-22T18:36:09Z" level=info msg="appending to multi args registry.gitlab.com/andrekr/kaniko-test:a"
time="2018-08-22T18:36:09Z" level=info msg="Downloading base image alpine:3.8"
ERROR: logging before flag.Parse: E0822 18:36:09.312497 9 metadata.go:142] while reading 'google-dockercfg' metadata: http status code: 404 while fetching url http://metadata.google.internal./computeMetadata/v1/instance/attributes/google-dockercfg
ERROR: logging before flag.Parse: E0822 18:36:09.315998 9 metadata.go:159] while reading 'google-dockercfg-url' metadata: http status code: 404 while fetching url http://metadata.google.internal./computeMetadata/v1/instance/attributes/google-dockercfg-url
2018/08/22 18:36:09 No matching credentials were found, falling back on anonymous
time="2018-08-22T18:36:09Z" level=info msg="Mounted directories: [/kaniko /var/run /proc /dev /dev/pts /sys /sys/fs/cgroup /sys/fs/cgroup/systemd /sys/fs/cgroup/pids /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/devices /sys/fs/cgroup/net_cls,net_prio /sys/fs/cgroup/freezer /sys/fs/cgroup/blkio /sys/fs/cgroup/hugetlb /sys/fs/cgroup/perf_event /sys/fs/cgroup/cpuset /sys/fs/cgroup/memory /dev/mqueue /builds/AndreKR /etc/resolv.conf /etc/hostname /etc/hosts /dev/shm]"
time="2018-08-22T18:36:09Z" level=info msg="Unpacking layer: 0"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /dev because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /etc/hostname because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /etc/hosts because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /proc because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /sys because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Not adding /var/run because it is whitelisted"
time="2018-08-22T18:36:09Z" level=info msg="Taking snapshot of full filesystem..."
time="2018-08-22T18:36:10Z" level=info msg="cmd: /bin/sh"
time="2018-08-22T18:36:10Z" level=info msg="args: [-c echo \"a\"]"
a
time="2018-08-22T18:36:10Z" level=info msg="Taking snapshot of full filesystem..."
time="2018-08-22T18:36:10Z" level=info msg="No files were changed, appending empty layer to config."
2018/08/22 18:36:12 pushed blob sha256:8e3ba11ec2a2b39ab372c60c16b421536e50e5ce64a0bc81765c2e38381bcff6
2018/08/22 18:36:12 pushed blob sha256:765d08ab15d5e744c8aed462accf69b9adb5e432d4024f25a31c674e7e194f56
2018/08/22 18:36:13 registry.gitlab.com/andrekr/kaniko-test:a: digest: sha256:7d59f984fe87a86c9346f3b122f5c23cdeeb881f15773eb59e2ea0ceacf82333 size: 428
$ /kaniko/executor --context $CI_PROJECT_DIR/b --dockerfile $CI_PROJECT_DIR/b/Dockerfile --destination $CI_REGISTRY_IMAGE:b
ERROR: logging before flag.Parse: W0822 18:36:13.133101 16 metadata.go:250] Google container registry is disabled, no storage scope is available: ["https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write"]
time="2018-08-22T18:36:13Z" level=info msg="appending to multi args registry.gitlab.com/andrekr/kaniko-test:b"
time="2018-08-22T18:36:13Z" level=info msg="Downloading base image alpine:3.8"
ERROR: logging before flag.Parse: E0822 18:36:13.145593 16 metadata.go:142] while reading 'google-dockercfg' metadata: http status code: 404 while fetching url http://metadata.google.internal./computeMetadata/v1/instance/attributes/google-dockercfg
ERROR: logging before flag.Parse: E0822 18:36:13.148609 16 metadata.go:159] while reading 'google-dockercfg-url' metadata: http status code: 404 while fetching url http://metadata.google.internal./computeMetadata/v1/instance/attributes/google-dockercfg-url
2018/08/22 18:36:13 No matching credentials were found, falling back on anonymous
time="2018-08-22T18:36:13Z" level=info msg="Mounted directories: [/kaniko /var/run /proc /dev /dev/pts /sys /sys/fs/cgroup /sys/fs/cgroup/systemd /sys/fs/cgroup/pids /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/devices /sys/fs/cgroup/net_cls,net_prio /sys/fs/cgroup/freezer /sys/fs/cgroup/blkio /sys/fs/cgroup/hugetlb /sys/fs/cgroup/perf_event /sys/fs/cgroup/cpuset /sys/fs/cgroup/memory /dev/mqueue /builds/AndreKR /etc/resolv.conf /etc/hostname /etc/hosts /dev/shm]"
time="2018-08-22T18:36:13Z" level=info msg="Unpacking layer: 0"
time="2018-08-22T18:36:13Z" level=error msg="symlink /bin/busybox /bin/arch: file exists"
Edited by André Hänsel