Passing multiple ENVs to docker executor fails (Need x ENVs + Proxy Settings - Maybe passing multiple envs does not work?
What am i trying to do:
I am using Gitlab-Runner with AWS ECS. I use Docker in Docker. Both without problems. My runner register an deregister finde. DID works like a charm. But only till it comes to Environment variables.
I need to set http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY to 172.17.0.1 ...
What did i tried
I can achive this with /root/.docker/config.json
bash-4.2# cat /root/.docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://172.17.0.1:8888",
"httpsProxy": "http://172.17.0.1:8888",
"noProxy": "localhost,127.0.0.1,172.17.0.1"
}
}
}
starting docker images manually with docker run inside my gitlab-runner-container works... the proxy is set.... even if i pass additional envs to this container:
bash-4.2# docker run --env "TEST=VALUE" -it amazonlinux bash
bash-4.2# env
HOSTNAME=fbf414a6de25
TERM=xterm
NO_PROXY=localhost,127.0.0.1,172.17.0.1
http_proxy=http://172.17.0.1:8888
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
HTTPS_PROXY=http://172.17.0.1:8888
https_proxy=http://172.17.0.1:8888
TEST=VALUE
SHLVL=1
HOME=/root
no_proxy=localhost,127.0.0.1,172.17.0.1
HTTP_PROXY=http://172.17.0.1:8888
_=/usr/bin/env
But it does not work if gitlab starts the container... then there is no proxy!
What did i else tried
I also tried adding the proxy ENVs to the config toml... also without any luck!
bash-4.2# cat /etc/gitlab-runner/config.toml
concurrent = 1
check_interval = 0
[[runners]]
name = "st1-gitlabrunner-iat-cf-runner"
url = "https:/****"
token = "***"
executor = "docker"
environment = ["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=/v2/credentials/you-do-not-need-to-know", "http_proxy=http://172.17.0.1:8888/", "https_proxy=http://172.17.0.1:8888/"]
[runners.docker]
tls_verify = false
image = "ruby:2.5"
privileged = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]
Leads to none of my environment variables is poplulated to the child docker startet with gitlab
even if i set the proxy settings to other envs it does not work:
bash-4.2# cat /etc/gitlab-runner/config.toml
concurrent = 1
check_interval = 0
[[runners]]
name = "blub"
url = "bla"
token = "blubber"
executor = "docker"
environment = ["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=/v2/credentials/bla", "test1=http://172.17.0.1:8888/", "test2=http://172.17.0.1:8888/"]
[runners.docker]
tls_verify = false
image = "ruby:2.5"
privileged = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]