Connecting to docker-in-docker from a GitLab CI runner -


i have gitlab pipeline want to:

  1. build java app
  2. test using docker-compose
  3. push docker repository

the primary issue i'm having works:

services:   - docker:dind  docker_test:   stage: docker_test   image: docker:latest   script:   - docker version 

the output printed expected:

> gitlab-ci-multi-runner exec docker --docker-privileged docker_test ... $ docker version client:  version:      17.06.0-ce ... server:  version:      17.06.0-ce ... build succeeded 

while does not (installation steps docker-ce omitted):

services:   - docker:dind  docker_test:   stage: docker_test   image: ubuntu:latest       << note change   script:   - docker version 

it fails with:

$ docker version client:  version:      17.06.0-ce  api version:  1.30  go version:   go1.8.3  git commit:   02c1d87  built:        fri jun 23 21:23:31 2017  os/arch:      linux/amd64 cannot connect docker daemon @ unix:///var/run/docker.sock. docker daemon running? error: build failed: exit code 1 fatal: exit code 1 

how make ubuntu image (or whatever image going build project) connect linked docker-in-docker service? what docker:latest doing i'm not?

i've read on gitlab services documentation, makes sense me hostname perspective. (if have mysql service, can connect on mysql:3306.)

edit: updating command echo $docker_host, see in docker:latest image:

$ echo $docker_host tcp://docker:2375 

and in ubuntu:latest image see:

$ echo $docker_host (nothing - doesn't let me add blank code line) 

as information you've added, hope work:

services:   - docker:dind  docker_test:   stage: docker_test   image: ubuntu:latest   variables:       docker_host: "tcp://docker:2375"   script:   - docker version 

alternatively:

services:   - docker:dind  docker_test:   stage: docker_test   image: ubuntu:latest    script:   - export docker_host=tcp://docker:2375   - docker version 

it seems gitlab not set docker_host variable custom images.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -