简体   繁体   English

Gitlab-runner + Docker + Windows - 无效的卷规范

[英]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.我试图在提交之前使用 Gitlab-runner 和 docker 在本地运行我的 Gitlab CI,以确保它们正常工作。 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).不幸的是,我别无选择,只能使用 Windows(我过去在 Linux 上取得了成功)。

Every time I run a job in powershell:每次我在 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:我试过设置 docker 卷(各种组合)和 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..由于 C 之后的冒号, Error response from daemon: invalid mode: /Gitlab-runner/builds失败Error response from daemon: invalid mode: /Gitlab-runner/builds

Can anyone point me in the right direction as I'm stumped?当我被难住时,有人能指出我正确的方向吗?

Using gitlab-runner version 11.5.0使用 gitlab-runner 版本 11.5.0

Docker is not fully supported by GitLab Runner on Windows yet. Windows 上的 GitLab Runner 尚未完全支持 Docker。 The workaround is to use Windows Subsystem for Linux and install gitlab-runner there:解决方法是使用适用于 Linux 的 Windows 子系统并在那里安装 gitlab-runner:

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

At the moment there isn't official support for the Docker executor in Windows.目前,Windows 中没有对 Docker 执行器的官方支持。 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.一个正在进行的 问题目前是开放的,看起来有些人已经设法让 Windows docker 执行程序在该合并请求中取得不同的成功。

This specific comment shows how they've managed to get it setup using a custom built gitlab-runner .这个特定的评论显示了他们如何使用自定义构建的 gitlab-runner设法设置它。 I'm unsure how this will work with Services however, so YMMV.但是,我不确定这将如何与服务一起使用,所以 YMMV。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM