Sergey Slepov
Sergey Slepov

Reputation: 2111

Way to speed up time inside Docker?

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.

Upvotes: 5

Views: 1294

Answers (2)

nunohpinheiro
nunohpinheiro

Reputation: 2269

@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.

Upvotes: 2

David Maze
David Maze

Reputation: 159040

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).

Upvotes: 2

Related Questions