Docker Community Forums

Share and learn in the Docker community.

Manual date control inside a containerr

I am trying to use a docker vm to test that some date/time code works with daylight savings time. I’ve created Dockerfiles for ubuntu which sets the timezone but I want to turn off date/time synchronization and hard set the date to Jan and Jul so that I can ensure daylight savings is off / on and that the date code still works.

I’ve tried using
date --set "25 Sep 2013 15:00:00"
date: cannot set date: Operation not permitted
Wed Sep 25 15:00:00 PDT 2013

hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.

root@cff83e1fa498:/# cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

root@cff83e1fa498:/# ps -ef
root 1 0 0 08:59 ? 00:00:00 bash
root 45 1 0 09:24 ? 00:00:00 ps -ef

Is there some other method of setting the system date when starting the container?