Run Containerlab in a GitLab-CI Docker-in-Docker environment #1688
Unanswered
neilschark
asked this question in
Q&A
Replies: 1 comment 13 replies
-
Hi @neilschark /cc @carlmontanari |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I got containerlab running in a docker-in-docker setup without problems with a VSCode dev container setup as it is mentioned in the documentation of containerlab.
The next step for us is to have containerlab running in GitLab-CI. We currently use a shell runner for it, but this setup is not very good for obvious reasons. So we want to migrate it so that each test uses its own containerized instance of containerlab and a topology.
I configured a docker-in-docker runner and based my image on the default docker-in-docker alpine image.
I then added all dependencies listed in containerlabs own dockerfile: https://github.com/srl-labs/containerlab/blob/29bf4912f127d5ccd28e71a59d6938046ac0755b/goreleaser.dockerfile#L6C1-L15C17
With this image, docker runs fine:
Docker can also create networks:
But unfortunately containerlab isn't able to create the docker network:
I then tried using the containerlab docker image directly as my image for this CI job. But this doesn't work, as GitLab-CI doesn't mount the docker socket into the container, but rather exposes the API to the container as a network service: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker
Which leads to the following obvious error:
$ containerlab deploy --log-level trace -t dev_env_data/clab/basic_two_aristas.yaml [...] Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
How is it possible to run containerlab in a GitLab-CI docker-in-docker environment?
Beta Was this translation helpful? Give feedback.
All reactions