Changed servers, and wanted to try launching runners as docker containers instead of installing directly to the server as described here:
https://docs.gitlab.com/runner/install/docker.html
And it works just the same as my old install for the most part with my old pipeline:
- build the dotnet core app, pass as artifact to ->
- build docker image from the app, deploy to registry ->
- clone repo to shell on local machine, do docker-compose up (to pull the new image from the registry and run it)
…except when it comes to the last step and actually deploying the results. What is the best practice for effecting a “docker compose up -d” on the local machine, when the “local machine” is really the docker container the runner is in, as far as the runner can tell? Thanks!
EDIT: Ok. the answer was easier than expected. Mounting the Docker host socket with:
-v /var/run/docker.sock:/var/run/docker.sock \
And ensuring that the runner configurations have this as well, you can communicate to the host machine and start containers without issue. I was getting hung up because I was using Docker-in-Docker as a habit on Gitlab CI, but it’s not needed in this case, and actually breaks things if in place.