Gitlab-runner + Docker + Windows - Invalid volume

2020-07-05 09:55发布

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

2条回答
唯我独甜
2楼-- · 2020-07-05 10:33

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
查看更多
SAY GOODBYE
3楼-- · 2020-07-05 10:34

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.

查看更多
登录 后发表回答