Reputation: 31
I am using a self hosted Gitlab repository to push my code. The code contains a Dockerfile that successfully creates a docker-image locally on my machine. My intention is now to automate this build process and integrate the docker-build in a Gitlab-Pipeline. I am bound to shared runners, so I can't integrate my own runners. And those runners aren't set up for simple docker-in-docker builds.
I saw another project who uses the image gcr.io/kaniko-project/executor:debug
for this problem. It successfully starts the build process of my Dockerfile, but after executing my first RUN
argument it starts to add millions of artifacts to the layer, till it freezes.
I tried to replace the node:latest image with node:slim and it went one execution further in the Dockerfile. So I think that the problem is within the loading of the base-image. But I can't make out the reason.
Is Kaniko not able to download the base-image?
Do I need to provide the base-image in a different way?
Does someone have an example for a functioning kaniko pipeline that builds an image based on node?
Following part shows the logs of the runner.
<pre>
>Resolved base name node:latest to node:latest
>Downloading base image node:latest
>No matching credentials were found, falling back on anonymous
>Error while retrieving image from cache: getting file info: stat /cache /sha256:a954de83ca1e2dfee3bdb4fedd56df42646f6325f50347482724626327b187c6: no such file or directory
>Downloading base image node:latest
>No matching credentials were found, falling back on anonymous
>Built cross stage deps: map[]
>Downloading base image node:latest
>No matching credentials were found, falling back on anonymous
>Error while retrieving image from cache: getting file info: stat /cache
/sha256:a954de83ca1e2dfee3bdb4fedd56df42646f6325f50347482724626327b187c6: no such file or directory
>Downloading base image node:latest
>No matching credentials were found, falling back on anonymous
>Unpacking rootfs as cmd RUN http_proxy=$proxy apt-get update && http_proxy=$proxy apt-get -y --no-install-recommends install apt-utils build-essential libudev-dev && true requires it.
>Taking snapshot of full filesystem...
>Adding /usr/share/icons/gnome/48x48/mimetypes/tgz.png to layer, because it was changed.
>Adding /usr/share/icons/gnome/32x32/actions/stock_select-all.png to layer, because it was changed.
>...Continues with adding stuff till it freezes
</pre>
Upvotes: 2
Views: 3251
Reputation: 60123
You need the kaniko executor's debug image, which provides sh
for gitlab-runner ci to execute
build:
image: gcr.io/kaniko-project/executor:debug
stage: build
script:
- executor --dockerfile=Dockerfile --context=$PWD --no-push
the reason for this is that if the image doesn’t allow to run scripts with CMD
, the image will not work with the Docker executor. see ref gitlab runner's docker executor
For other docker push
, you can follow the example to add extra configuration in your .gitlab-ci.yaml
.
Upvotes: 1