Let me share a working advice you can use in case you need to jump in time in a Docker container. You may need this for testing purposes, for instance, to test some events in the future.
You will need a Docker Image of the app you need want to launch.
Create Docker file:
FROM my-image
RUN apt update -y && apt install -y faketime
Build a container naming it fake-time
:
docker build -t fake-time .
Run new container
docker run fake-time:latest faketime '2030-12-18 19:46:00' ./your-app
Or use it inside docker-compose:
service:
image: "fake-time:latest"
command: "faketime '2030-12-18 19:46:00' ./your-app
Follow me on X for more development tips.
Top comments (0)