Skip to content

HuongNV96/ntp-mock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delivering mock time with NTP

The included NTP server can be used to update clients with a fake time. The delta to correct time is controlled by env variable FAKETIME (on command line or in .env). For example set

FAKETIME=-15y

to let the NTP server deliver a time fifteen years in the past. Clients have to be set up to use the mock time source via the IP of the host Docker runs on.

Build and run

Run as a service using docker compose

A Dockerfile and a service definition for docker compose are included. So after setting up .env you can run the service using docker compose:

docker-compose build && docker-compose up -d ntp

After changes to FAKETIME the NTP service has to be restarted:

docker-compose stop ntp && docker-compose up -d ntp

Run manually using Docker

Alternatively you can run the service purely with Docker providing the complete setup in the parameters of docker run:

docker build -t ntp-mock:latest . && docker run -p 127.0.0.1:123:123/udp --env FAKETIME=+15d --cap-add SYS_TIME ntp-mock:latest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 100.0%