Gitlab Runner as Docker with Docker Executor, Running Docker Images


I’m trying to set up my gitlab-runner for CI.

Im using gitlab-runner as docker.
Executor on the gitlab-runner is also docker.

What i want to do is to build, and run a docker image, and some tests against it.

So basically it’s like Docker (image to build) in Docker (executor), in Docker (gitlab-runner).

Is it possible to make it work?

I’m using self-managed instance, with versions:

  • GitLab 13.7.1-ee - w/o license
  • GitLab-Runner 13.7.0

I’ve been trying to use Kaniko (want to avoid priviledged mode etc.) just for building the image, but i failed with errors.

  stage: build
    entrypoint: [""]
    - executor --dockerfile=Dockerfile --context=$PWD --no-push

Gave me that result, as it seems like some network error i’ll mention that i’m behind a proxy:

$ /kaniko/executor --no-push --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile
INFO[0000] Using dockerignore file: /builds/lumenn/technology-api/.dockerignore 
INFO[0000] Retrieving image manifest node:14.15.1       
INFO[0000] Retrieving image node:14.15.1                
ERRO[0154] Error while retrieving image from cache: node:14.15.1 Get "": dial tcp i/o timeout 
INFO[0154] Retrieving image manifest node:14.15.1       
INFO[0154] Retrieving image node:14.15.1                
error building image: Get "": dial tcp i/o timeout
Cleaning up file based variables
ERROR: Job failed: exit code 1

I was mostly trying to find the answer here:

Also i’ve succesfully run this - as you can see i had to add the proxy for npm:

  stage: build
  image: node:14.15.1
    - npm set https-proxy http://mighty-proxy-adress:port/
    - npm install
    - npm start

I will appreciate any suggestions and help :slight_smile:

Have you tried following this section about applying proxy settings to the second docker service (when using docker-in-docker)? Running GitLab Runner behind a proxy | GitLab