I’ve got a gitlab container running on docker. I want to define a gitlab runner to run the docker I use on my machine. I’m stuck.
Should I make a symlink from the container to the docker
executable on the machine when building the image? If yes then how should I do that?
If above is not possible how should I handle the situation I have?
2
Answers
The solution is docker in docker (
dind
) can be seen here.If I understand you correct, you want an access to docker engine of your host environment from your gitlab container. So, for example, when you execute
docker ps
in your gitlab container you actually accessing docker engine of the host machine.To achieve that you have to do 2 things:
Install docker cli inside your gitlab container, I’m not familiar with this image, probably docker cli is already here, but to be sure here how to do this. In short:
This will copy cli binaries from docker image into your container.
Docker cli communicates with docker engine via unix socket:
/var/run/docker.sock
so you’ll have to mount it inside your gitlab container.If your docker engine host Os is windows, you’ll have to mount it
like this:
If your docker engine host OS is linux, it is pretty straightforward: