EastOcean
EastOcean

Reputation: 1252

reconfigure timezone inside docker not working

First, I configure timezone in my Dockerfile as below, but it fails(as I go inside docker container and execute 'date', only to get a Etc/UTC time).

   FROM selenium/standalone-firefox:3.0.1-aluminum
   USER root
   RUN echo "Asia/Shanghai" > /etc/timezone
   RUN dpkg-reconfigure -f noninteractive tzdata

Then, I try again as below, it seems 'dpkg-reconfigure' reset the /etc/timezone. So what's wrong on earth?

enter image description here

Supplement: After I follow the method as BMitch suggested, it does make a step forward, but another confusing problem occurs: date command inside docker container prints a wrong time. enter image description here

Upvotes: 2

Views: 1987

Answers (1)

BMitch
BMitch

Reputation: 264156

Selenium bases their images on Ubuntu, and Ubuntu changed the behavior of a non-interactive tzdata reconfigure from the standard Debian method. Use the following instead:

FROM selenium/standalone-firefox:3.0.1-aluminum
USER root
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
 && dpkg-reconfigure -f noninteractive tzdata

See this bug report for more details.

Upvotes: 4

Related Questions