GKE uses containerd for executing docker image. Using this guide (https://docs.dagger.io/ci/integrations/gitlab/), I've successfully exposed containerd's socket for my Gitlab runner in k8s configuration.
Within my CI, the alpine container is privileged. I declare the following pipeline that installs nerdctl & dagger for debugging:
.dagger:
variables:
DAGGER_CLOUD_TOKEN: $DAGGER_CLOUD_TOKEN
before_script:
- |
export PATH=/tmp:$PATH
export _EXPERIMENTAL_DAGGER_RUNNER_HOST=unix:///var/run/containerd/containerd.sock
export DOCKER_HOST=unix:///var/run/containerd/containerd.sock
apk add curl nerdctl
ln -s /usr/bin/nerdctl /usr/bin/docker
export PATH=/tmp:$PATH
curl -fsSL https://dl.dagger.io/dagger/install.sh | BIN_DIR=/tmp sh
check:
extends: [.dagger]
script:
- |
ls -la /var/run/containerd
whoami
dagger core version
The results states that I'm running as root within this container and that it can access to /var/run/containerd/containerd.sock :
...
3 : ┆ connecting to engine
4 : ┆ ┆ moby.buildkit.v1.Control/Info
4 : ┆ ┆ moby.buildkit.v1.Control/Info ERROR [0.0s]
4 : ┆ ┆ ! unknown service moby.buildkit.v1.Control
...
3 : ┆ connecting to engine ERROR [0.0s]
3 : ┆ ! new client: failed to call info: Unimplemented: unknown service moby.buildkit.v1.Control
1 : connect ERROR [0.0s]
1 : ! start engine: new client: failed to call info: Unimplemented: unknown service moby.buildkit.v1.Control
Error: start engine: new client: failed to call info: Unimplemented: unknown service moby.buildkit.v1.Control
Unfortunately, dagger is having issue with nerdctl which seems not properly configured for using the exposed containerd's socket.
Does somebody has a success to share using dagger on Gitlab runner within GKE?