Search code examples
gitlabgitlab-cigitlab-ci-runnergitlab-ce

GitLab CI/CD configuration problem using shared runners


I have problems with GitLab CI/CD configuration - I'm using free runners on GitLab it self. I have joomla (test) project using docker - I'm learng how it's work. I created .gitlab-ci.yml with:

image: docker:latest
services:
  - docker:dind

at top of file.

On test stage I want run docker image created at the build stage. When I add:

services:
    - mariadb:latest

to test stage I always get Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? at docker pull command. Without it I get error at docker run command at joomla image initialization cose of lack of MySql server

Any help will be appreciated.


Solution

  • If you set

    services:
        - mariadb:latest 
    

    in your test job, this will override the globally defined services. Therefore, the docker daemon is not running during test. This also explains why you do not get the Docker daemon error when you omit the services definition for the test job.

    Either specify the docker:dind service also for the test job, or remove the local services definition and add mariadb to your global services definition.