简体   繁体   English

docker 中 windows 上的 gitlab-runner 无法运行并出现错误的 OSType 错误

[英]gitlab-runner on windows in docker fails to run with wrong OSType error

I have a gitlab-runner on a Windows Server with enabled Hyper-V.我在启用 Hyper-V 的 Windows 服务器上有一个 gitlab-runner。

With the docker API exposed to the network I'm able to run linux docker containers and even docker itself with docker:latest. With the docker API exposed to the network I'm able to run linux docker containers and even docker itself with docker:latest.

e:\>docker run -ti --rm -e DOCKER_HOST=tcp://10.99.0.12:2375 --name test docker:latest

/ # docker ps
CONTAINER ID ....
xxxxx docker:latest ... Up 10 seconds

/ # docker run -ti --rm busybox uname -a
Linux 42342423 4.14.35 ... 

So that seems to be all correct.所以这似乎都是正确的。

When I now want to run a docker-compose up -d in my deploy stage, I'll get an error from gitlab-runner当我现在想在部署阶段运行docker-compose up -d时,我会收到来自 gitlab-runner 的错误

Running with gitlab-runner 12.10.0 (c553af1a)
   on Staging Runner
Preparing the "docker" executor
 ERROR: Removing network for build
 ERROR: Job failed: executor requires OSType=linux, but Docker Engine supports only OSType=windows

I maybe could run gitlab-runner directly on the host machine, but rather have everything in the repository and only need to have docker installed.我也许可以直接在主机上运行 gitlab-runner,而是将所有东西都放在存储库中,只需要安装 docker。

I've run into this recently.我最近遇到了这个。 You have to go into Docker on your Windows host and select the "Switch to Linux containers..." option. You have to go into Docker on your Windows host and select the "Switch to Linux containers..." option.

Related:有关的:

For everyone coming across this with the same problem.对于遇到同样问题的每个人。

Gitlab doesn't want to implement LCOW at the moment so it's not possible with docker-executor. Gitlab 目前不想实现 LCOW,因此 docker-executor 无法实现。

More info: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4373更多信息: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4373

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

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