GitLab-CI multi runner start docker container

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)

  • What does it mean to attach a tty/std-in-out to dockers or lxc?
  • Deploy a Jekyll site from Gitlab with Gitlab CD?
  • Mariadb losses data after system is restarted
  • Jupyter kernel dead
  • Docker registry and index
  • Docker container linking via port forwarding?
  • 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

  • Can I pass arguments into docker-compose the command config option
  • Spin off another container on host machine from an existing container
  • how to set max_execution_time php-fpm docker image?
  • Jenkins Docker Pipeline Exit Code -1
  • how get env variables from docker in symfony yml config file
  • How to properly give argument to docker entrypoint when building a container (docker run …)?
  • 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 \

    Afterwards, you have to register the runner with:

    1. docker as executor.
    2. the Docker image with the linters you want as Docker image.

    Every 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 unix:///var/run/docker.sock

    PS: You nedd to install docker in the gitlab-runnercontainer

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.