Way to speed up time inside Docker?

Viewed 460

Suppose I have an app that does something on a timer every second. Is there a way to make the timer tick 10 times a second using Docker? So the app appears to run faster to anyone outside the Docker container.

2 Answers

Docker containers share the host's kernel and clock. Time is the same inside and outside the container. If a privileged container changes the time, it will change the time for the entire system. You can't make the clock in a container run at a different speed or otherwise show a different time from the host (up to time zones).

@David Maze's answer is great, that's exactly why I asked for more details about the timer :)

Just to add some ideas, I think there could be 2 ways to solve the problem:

  1. Include logic in the app itself to execute the required instructions in the required time interval;
  2. Build a second app to orchestrate the execution of the logical app, according to the set time interval.
Related