I'm trying to setup a Gitlab CI pipeline using docker image. For some reason, I need to set the host name of the docker container to a special value.
When running docker container locally, this can be done by specifying the -h|--hostname option. But in gitlab's official help document, it seems that only 'name' and 'entrypoint' keywords are supported for setting 'image' in .gitlab-ci.yml file.
Is there anyway to set the docker container's host name?
Finally I found one solution from this page by myself: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section
Here are my steps:
To restrict the docker containers that will use the hostname set in step 3, you can:
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