Giter Club home page Giter Club logo

ntpd-docker's Introduction

ntpd Server Docker Image

Usage

docker run --name ntp -d -p 123:123/udp lfkeitel/ntpd

The image exposes NTP port 123/udp.

Configuration

The configuration is located at /etc/ntp.conf and by default following will be generated:

interface listen all
driftfile /var/lib/ntp/ntp.drift

statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

restrict default kod notrap nomodify nopeer
restrict -6 default kod notrap nomodify nopeer

restrict 127.0.0.1
restrict ::1

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

logfile /dev/stdout

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

Custom Servers

To set servers, use the environment variables SERVERS and SERVERS_IBURST. SERVERS_IBURST will simply add the iburst option for the servers in the list. If no servers are specified, servers from the global NTP pool are used. Servers are space separated so make sure to enclose them in quotes.

docker run \
    --name ntp \
    -e SERVERS_IBURST='0.pool.ntp.org 1.pool.ntp.org'
    lfkeitel/ntpd:latest

Any other configuration can be done by either making a new image from this one with a custom config, or using a volume mount to /etc/ntp.conf.

Statistics

Statistics for loopstats, peerstats, and clockstats are enabled by default and are stored in /var/log/ntpstats which is exposed as a volume. You can control this with the environment variables STATS_ENABLED and CRON_ENABLED. Unless specified otherwise, CRON_ENABLED will be the same as STATS_ENABLED. Cron is used to rotate NTP statistics logs. If you don't want to rotate logs, set CRON_ENABLED=false. To disable statistics altogether, set STATS_ENABLED=false. If statistics are disabled, cron will also be disabled.

Peers

By default, no servers are allowed to peer with ntpd. The environment variable ALLOWED_PEERS can be used to list servers that are allowed to peer. This list will generate restict lines with the format restrict $SERVER kod notrap nomodify.

ntpd-docker's People

Contributors

lcnja avatar lfkeitel avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

kushtrimjunuzi

ntpd-docker's Issues

New ntpd syntax

Apparently I was not aware that ntpd changed its configuration format or at least something about it is different from just about every tutorial I saw when making this initially. The configuration as it's currently generated does not work right. Peers don't work and listening doesn't appear to work correctly. Basically, it's broken. A fix is on the way though. It should be pushed hopefully tomorrow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.