Gitlab CI runner not getting CI_XXX envrionment variables

runner

#1

I have installed gitlab runner on my linux laptop. I have registered it. Here is the config.toml

concurrent = 1
check_interval = 0

[[runners]]
name = “my-laptop-runner”
url = “https://gitlab.com
token = “redacted”
executor = “docker”
[runners.docker]
tls_verify = false
image = “docker:18-dind”
privileged = true
disable_cache = false
cache_dir=“cache”
volumes = ["/var/run/docker.sock:/var/run/docker.sock", “/cache”]
shm_size = 0
[runners.cache]
Insecure = false

I run it like this.

gitlab-runner exec docker --docker-privileged build_container

It runs the CI script but fails because none of the usual gitlab CI_XXXX env variables exist.

the relevant part of the output

$ echo $CI_JOB_TOKEN

$ docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
ERROR: Job failed: exit code 1
FATAL: exit code 1

CI_JOB_TOKEN does not exist and therefore the build fails.

How can I fix this.

Thanks.