Docker jobs: Add a "generic run flags" or "--net" option to be passed to `docker run <args> <image>`
Problem
For one of our build jobs we need the docker image to use the host computers network device (for more info see this). This is needed to get some compiler license working.
When running things locally in docker, using docker run -it -v </path/to/license/file:/path/to/license/file> --net=host <image>
it works fine. The critical part is the --net=host
flag.
The licensing won't work when fully run within the container (with a "normal" docker net adapter, and the license file in the container). We really need the host to get it working.
Proposed solution
In .gitlab-ci.yml
and/or in /etc/gitlab-runner/config.toml
add a way to pass either generic run flags, or to set the --net setting. E.g.
gitlab-ci.yml
:
build_job:
stage: build
image: myimage:latest
docker_run_flags: --net=host
# OR
docker_net: host
/etc/gitlab-runner/config.toml
:
[runners.docker]
image = "myimage:latest"
volumes = ["/cache"]
run_flags = "--net=host"
# OR
net = "host"
Edited by 🤖 GitLab Bot 🤖