Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab-runner + Docker + Windows - Invalid volume specification

I'm trying to run my Gitlab CI locally using Gitlab-runner and docker before committing to make sure they work okay. But I'm having some strange issues!

Unfortunately I have no choice but to use windows (I've had success in the past on Linux).

Every time I run a job in powershell:

C:/Gitlab-runner/gitlab-runner exec docker npm

I get an error:

Job failed (system failure): Error response from daemon: invalid volume specification: '/host_mnt/c/builds/project-0/Users/Lewsmith/api:C:/Users/Lewsmith/api:ro' (executor_docker.go:921:0s)

I've tried setting docker volumes (nemerous combinations) and builds-dir:

C:/Gitlab-runner/gitlab-runner exec docker --builds-dir /builds --docker-privileged --docker-volumes "/builds:C:/Gitlab-runner/builds" npm

That fails with Error response from daemon: invalid mode: /Gitlab-runner/builds because of the colon after the C..

Can anyone point me in the right direction as I'm stumped?

Using gitlab-runner version 11.5.0

like image 423
Lewsmith Avatar asked Nov 25 '18 22:11

Lewsmith


2 Answers

Docker is not fully supported by GitLab Runner on Windows yet. The workaround is to use Windows Subsystem for Linux and install gitlab-runner there:

curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
sudo apt-get install gitlab-runner
gitlab-runner exec docker build
like image 173
Vitaliy Ulantikov Avatar answered Oct 16 '22 07:10

Vitaliy Ulantikov


At the moment there isn't official support for the Docker executor in Windows. A work in progress issue is open at the moment, and it looks like some people have managed to get a windows docker executor working to varying success in that merge request.

This specific comment shows how they've managed to get it setup using a custom built gitlab-runner. I'm unsure how this will work with Services however, so YMMV.

like image 21
Rekovni Avatar answered Oct 16 '22 09:10

Rekovni