Skip to content

Job failed - gitlab-ci #21

Closed
Closed

Description

@programmingworld1

Hi, I copied and paste the code into the gitlab-ci.yml file but it says that the job has failed.. How can I fix this, I have been struggling with gitlab-ci in combination with my project that is docker-composed based.. Please help me out.

Pulling docker image tmaier/docker-compose:latest ...
Using docker image sha256:7f72c82000a4b80146e835ff4678fbf64cd50ea5549ff411a84fbea25d12027e for tmaier/docker-compose:latest ...
Running on runner-MY6PvAGd-project-12-concurrent-0 via ovs-transip-gitlab-runner...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/murat.yilmaz/devicemanagerapp/.git/
Created fresh repository.
From https://devops.ovsoftware.com/murat.yilmaz/devicemanagerapp
 [new branch]      master     -> origin/master
Checking out b1ac0c93 as master...
Skipping Git submodules setup
$ docker info
Client:
 Debug Mode: false
Server:
ERROR: error during connect: Get http://docker:2375/v1.40/info: dial tcp: lookup docker on 195.8.195.8:53: no such host
errors pretty printing info
ERROR: Job failed: exit code 1

Activity

  1. desm commented on Oct 3, 2019

    @desm

    Maybe try editing your GitLab runner's config file (config.toml) by changing "volumes = ["/cache"]" to "volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]" and see if that helps?

  2. desm commented on Oct 3, 2019

    @desm

    I forgot to specify that the approach I suggested just now is based on this: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding

  3. tmaier commented on Jan 13, 2020

    @tmaier
    Owner

    Can you please provide more information: Are you using gitlab.com? Are you using your own cloud-runner? How is it set up? How is docker configured here?

  4. abmruman commented on Jan 27, 2020

    @abmruman

    @programmingworld1 , @tmaier This can happen while using newer docker images like version 19.03. Although this issue is a bit old, but the problem persists till today.

    I faced the issue recently and turns out there is a known "solution" or workaround however.
    Refer to this Release Note, if you want more details.

    Reason:

    As of version 19.03, docker:dind will automatically generate TLS certificates and require using them for communication. This is from Docker's official documentation:

    Solution/workarounds:

    According to the Release Note, there are 2 workarounds:

    1. Explicitly turn off TLS.
    2. Configure GitLab Runner to use TLS.

    Turn off TLS

    If you cannot or do not want to edit the config.toml, like in a gitlab shared runner:

    .gitlab-ci.yml:

    image: tmaier/docker-compose:19.03
    
    variables:
      DOCKER_TLS_CERTDIR: ""

    Configure TLS

    If you are running jobs on a runner that you have write access to the config.toml file (and you know what you are doing):

    config.toml:

    ...
    
    [[runners]]
      name = "My Docker Runner"
      url = "http://gitlab.com"
      token = ""
      executor = "docker"
      [runners.custom_build_dir]
      [runners.docker]
        ## Changes here ##
        privileged = true  ## may not be necessary, default is false
        volumes = ["/certs/client", "/cache"]  ## adds volume "/certs/client"
        shm_size = 0
    
    ...
    

    .gitlab-ci.yml:

    image: tmaier/docker-compose:19.03
    
    variables:
      # Create the certificates inside this directory for both the server
      # and client. The certificates used by the client will be created in
      # /certs/client so we only need to share this directory with the
      # volume mount in `config.toml`.
      DOCKER_TLS_CERTDIR: "/certs"`
  5. tmaier commented on Apr 12, 2020

    @tmaier
    Owner

    Thank you, @abmruman. I hope it solved the issue for @programmingworld1. I am closing this issue

  6. brice-gros commented on Apr 20, 2020

    @brice-gros

    privileged = true appeared to be necessary on my case
    Thank you very much @abmruman

  7. abmruman commented on Apr 22, 2020

    @abmruman

    @brice-gros , I came to learn that if you want to use docker-in-docker service, you need a privileged runner.

  8. Michael1024-CJX commented on Apr 21, 2022

    @Michael1024-CJX

    I tried configuring TLS, but it didn't work. Problem solved by configuring

    [runners.docker]
        volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    
  9. lwiechec commented on Dec 2, 2022

    @lwiechec

    thanks a lot - @Michael1024-CJX method helped me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions