0

I have docker-compose file which is working fine locally on my computer. I register gitlab-runner on the same pc and every pipeline where I use any docker command fails with an error: "docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?". I believe I've tried all proposed solutions - nothing works. I use private company network with VPN, maybe it is the issue. My gitlab-ci.yml

build:docker:
  image: docker:19.03.12-dind

  variables:
    DOCKER_HOST: tcp://docker:2375/
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
    DOCKER_PRIVILEGED: "true"
  services: 
    - name: docker:19.03.12-dind
      alias: docker
      command: ["--tls=false"]
  before_script:
    - apk update
    - apk upgrade
    - apk add py3-pip docker
    - apk add --no-cache bash python3
    - docker build -t $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:${CI_COMMIT_REF_SLUG}_server.$CI_PIPELINE_ID ./server/
    - docker run -d -p 80:80 docker/getting-started
    # - docker-compose -f docker-compose.yml up

my gitlab-runner created as a docker container using docker exe

If someone faced the same problem please help me understand what am I missing here.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • Can you provide your sanitized gitlab-runner configuration toml? – sytech Feb 21 '22 at 18:50
  • @sytech `concurrent = 1 check_interval = 0 [session_server] session_timeout = 1800 [[runners]] name = "crunner" url = "https://git.icdc.io/" token = "********************" executor = "docker" [runners.custom_build_dir] [runners.cache] [runners.cache.s3] [runners.cache.gcs] [runners.cache.azure] [runners.docker] tls_verify = false image = "alpine:3.15.0" privileged = true disable_entrypoint_overwrite = false oom_kill_disable = false disable_cache = false volumes = ["/cache"] shm_size = 0 ` – Pavel Mayevski Feb 22 '22 at 13:17
  • There's nothing that sticks out to me as misconfigured. As long as `docker` is properly installed/running on the _host_ system and the user/group running the `gitlab-runner` process has permission to access the docker socket, I would expect this configuration to work. – sytech Feb 22 '22 at 17:40
  • @sytech I sign in as a root user and in docker there are some running containers already. They seem to run properly. – Pavel Mayevski Feb 23 '22 at 08:37

0 Answers0