Gitlab Runner as Docker with Docker Executor, Running Docker Images

Hello,

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.

build-docker-image:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - 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 "https://index.docker.io/v2/": dial tcp 52.55.43.248:443: i/o timeout 
INFO[0154] Retrieving image manifest node:14.15.1       
INFO[0154] Retrieving image node:14.15.1                
error building image: Get "https://index.docker.io/v2/": dial tcp 34.192.114.9:443: i/o timeout
Cleaning up file based variables
00:00
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:

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

I will appreciate any suggestions and help :slight_smile: