Gitlab-Runner Docker wrong time zone in runner container

Dear Gitlab-Community,

I’m working with Gitlab-Runner in a Docker Container on MacOS recently.
I run the containers with the following command:

docker run -d --name gitlab-runner --restart always -v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock -e TZ=Europe/Berlin gitlab/gitlab-runner:latest

The runner is working fine and the registration to our Gitlab-Project worked, too.
However I discovered a little issue regarding the time. I set the Timezone for this container to match my local time, but if I start a pipeline I noticed that another additional container gets started (named “runner----andsoon”) who does the actual job in running the pipeline. The problem seems to be that the timezone is wrong in this additional runner container and therefore the build time differs from the local time. This is not that much of a problem technically but not nice If the built time differs for some hours. Is there a way to configure the gitlab-runner container to start this additional containers with the correct timezone? Since it gets named and started dynamically I can’t use “docke run -e”.

Thanks in advance and regards

A little update. I’m using the docker executor of gitlab-runner docker. Is it maybe possible to configure the timezone in the .gitlab-ci.yml or configure the docker executer with the config.toml to use the specific timezone for the containers?

@DerDude6 This issue might help, it looks like the person who opened the issue with our team posted a solution that worked for them:

Thank you very much! I will try this solution maybe, too. In the meantime I found a solution myself. Inspired by some suggestions from the internet, which did this for normal containers I edited the config.toml and used “volumes” to mount my timezone binary file to /etc/localtime. This works and the docker containers started from the docker executor have the correct time now! :slight_smile: