I have MicroK8s cluster node with Gitlab Runner container. I can delegate Gitlab pipeline steps to this container. This works fine but I also want to build and run Docker images in this container. When I try for example command like below:
docker run --rm -v $(pwd)/test/:/test --ipc=host --user pwuser registry.gitlab.com/c2platform/docker/robot:latest bash -c "robot --outputdir /tmp/output /test"`
This fails with message
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
So the log shows that the Gitlab Runner pod is using Kubernetes executor.
Is it possible to use Docker inside a Kubernetes pod?
With Docker in Docker I noticed that sometimes a mount is used
docker run --name whater -it --rm -v /var/run/docker.sock:/var/run/docker.sock ubuntu:latest bash
Inside the container I can then run
apt update && apt install docker.io
docker ps
docker run --name whatever2 -it --rm ubuntu:latest bash # works
So in order to enable this, I could install docker.io
on MicroK8s worker nodes? Does this make sense?