I have a gitlab-runner on a Windows Server with enabled Hyper-V.
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
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.
I've run into this recently. 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.
More info: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4373
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With