Ask Your Question

Fedora 28 docker - Failed to open connection to session bus then trying to set timezone

asked 2018-05-24 05:15:41 -0500

NM gravatar image

updated 2018-05-24 05:19:32 -0500

Hi, I am using fedora 28 docker image and trying to set correct timezone in the container.

using command:

timedatectl set-timezone Europe/Berlin

getting this error:

Failed to create bus connection: No such file or directory

Any idea what is wrong ???

here is my docker file:

FROM fedora:28
## Get all updates and install jdk
RUN dnf update -y &&  dnf install -y java-1.8.0-openjdk-devel.x86_64 unzip zip 
RUN timedatectl set-timezone Europe/Berlin
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-05-24 06:05:20 -0500

jo_117 gravatar image

updated 2018-05-24 06:44:48 -0500

hhlp gravatar image

list of timezone names:

try this,

ENV TZ=Europe/Berlin RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


You can add your local files (/etc/timezone and /etc/localtime) as volume in your docker-container.

Update your docker-compose.yml with the following lines.

volumes: - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro"

Now the container time is the same as on your host

edit flag offensive delete link more

answered 2018-05-24 06:07:40 -0500

jo_117 gravatar image

try this also,

docker run -e TZ=Europe/Amsterdam date

sometimes it also works

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-05-24 05:15:41 -0500

Seen: 220 times

Last updated: May 24 '18