7

I have problem with dynamically date change inside container. What I have:

docker run -it --privileged myDocker

the command above run container with privilege to change date

I can change date by:

date --set "12-12-12" 

but after a few seconds, the date and time are setted the same as the host

root@660acd776c6b:/# date --set "12-12-12"
root@660acd776c6b:/# date
Wed Dec 12 00:00:01 UTC 2012
root@660acd776c6b:/# date
Wed Dec 12 00:00:02 UTC 2012
root@660acd776c6b:/# date
Wed Dec 12 00:00:02 UTC 2012
root@660acd776c6b:/# date
Tue Jan 15 10:14:26 UTC 2019
root@660acd776c6b:/# date
Tue Jan 15 10:14:27 UTC 2019

The container doesn't have installed ntp. I can't use faketime because I use the date in .net application which doesn't use time from faketime. I can't change system clock using faketime.

How could I disable synchronization between container and host ?

Szymson
  • 990
  • 1
  • 13
  • 28
  • Possible duplicate of [Is it possible change date in docker container?](https://stackoverflow.com/questions/29556879/is-it-possible-change-date-in-docker-container) – David Maze Jan 15 '19 at 14:40
  • 2
    Short answer: you can’t, there is only one clock (assuming you’re not using one of the VM-based non-Linux solutions) and no “synchronization” _per se_. – David Maze Jan 15 '19 at 14:40

0 Answers0