I want to do the build of my image on a shared runner and build it on gitlab registry.
then I want to pull that image, on my server using the runner on my server using shell executor.
but I face a problem, on my shell executor when i try to run a docker command, gives me this error
$ docker info error during connect: Get http://docker:2375/v1.37/info: dial tcp: lookup docker on 172.31.0.2:53: no such host
here is my gitlab-ci.yml
image: docker:stable services: - docker:dind variables: CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH DOCKER_HOST: tcp://docker:2375 DOCKER_DRIVER: overlay2 stages: - build - deploy before_script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com build: stage: build script: - docker pull $CONTAINER_IMAGE:latest || true - docker build -f docker-images/web/Dockerfile --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest . - docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA - docker push $CONTAINER_IMAGE:latest deploy: stage: deploy script: - docker pull $CONTAINER_IMAGE:latest || true tags: - deploy - shell
I tested without the build stage, and comented the variables DOCKER_HOST and services docker:dind, and works. Execute the docker commands and works well.
I'm new on this, i think the problem is that my shell executor tries to comunicate with the docker host tcp://docker:2375, and not my docker engine.
What can I do?. I was thinking on call a shell script, and run the docker commands on this script. But I would like to do it directly on my gitlab-ci.yml