Source: https://gitlab.com/gitlab-org/gitlab-runner/issues/1583#note_93170156
OK, I've experimented a lot getting this going with the docker+machine executor (specifically with the amazonec2 driver, which I suspect is quite common for people looking at this thread!), it may also be helpful to others when debugging what's going on for them.
docker+machine is interesting because it has several relevant contexts (i.e. a file system and environment variables), which I shall refer to as:
- "runner": what is running the
gitlab-runner binary - in my case this is an ECS-managed docker container for the gitlab/gitlab-runner image on docker hub, but it could the systemd service configuration if you're running directly on the machine.
- "job host": the docker-machine created machine (e.g. EC2 instance) that runs the docker daemon
- "job container": the docker container for the image specified in the project
.gitlab-ci.yaml (or the default in config.toml)