I still don't quite understand the process for a gitlab-ci multi runner to start a docker and interact inside with the code.
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
To use GitLab Runner with Docker you need to register a runner that uses the Docker executor. The registered runner uses the ruby:2.6 Docker image and runs two services, postgres:latest and mysql:latest , both of which are accessible during the build process.
You can use GitLab CI/CD with Docker to create Docker images. For example, you can create a Docker image of your application, test it, and publish it to a container registry. To run Docker commands in your CI/CD jobs, you must configure GitLab Runner to support docker commands.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With