GitLab-CI multi runner start docker container
Is it possible for a gitlab-ci multi runner to start a docker container having the current code inside this docker container and then run tests against this code? (e.g.: code linting)
I basically want a docker container that has various linters installed.
GitLab-CI multi runner should run on the host system and start the docker container on-demand. Inside the docker container, the code should be checked against phpcs for example.
How do I get the repo code into the docker container?
Thanks for the help
2 Solutions collect form web for “GitLab-CI multi runner start docker container”
First, gitlab-runner needs to have the Docker socket mounted as described in the documentation:
docker run -d --name gitlab-runner --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /srv/gitlab-runner/config:/etc/gitlab-runner \ gitlab/gitlab-runner:latest
Afterwards, you have to register the runner with:
- docker as executor.
- the Docker image with the linters you want as Docker image.
docker client will forward the commands to the
docker daemon,the docker daemon will listen to the local port such as http,tcp or unix socket.
When you start container like this:
docker run -d –name gitlab-runner –restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
All the docker commands will forward to the host,as the docker was listening on
PS: You nedd to install docker in the