I have created a Docker container using the Ubuntu 16.04 image.
docker run -it -d --name containername -v /var/www/public --privileged ubuntu
Simply map the volume while running docker container
-v /etc/timezone:/etc/timezone:ro
Try:
echo "Asia/Kolkata" > /etc/timezone
rm -f /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
You have to do rm /etc/localtime
because of the Ubuntu bug.
Updating /etc/timezone
is the usual way, but there's a bug in Xenial which means that doesn't work.
Instead you need to create a link from the desired timezone to etc/localtime
:
FROM ubuntu:xenial
RUN ln -fs /usr/share/zoneinfo/US/Pacific-New /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
SOLVED:
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y software-properties-common apt-utils locales tzdata
RUN echo "tzdata tzdata/Areas select Europe" > timezone.txt
RUN echo "tzdata tzdata/Zones/Europe select Rome" >> timezone.txt
RUN debconf-set-selections timezone.txt
RUN rm /etc/timezone
RUN rm /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata