All Projects → cturra → Docker Ntp

cturra / Docker Ntp

Licence: apache-2.0
🕒 Chrony NTP Server running in a Docker container (without the priviledged flag)

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Docker Ntp

Netflix Proxy
Smart DNS proxy to watch Netflix
Stars: ✭ 3,220 (+3219.59%)
Mutual labels:  alpine-linux
Docker Kubectl
Containerized Kubernetes kubectl
Stars: ✭ 52 (-46.39%)
Mutual labels:  alpine-linux
Svn Docker
Lightweight Docker image to build a container running an SVN server
Stars: ✭ 87 (-10.31%)
Mutual labels:  alpine-linux
Aports
[MIRROR] Alpine packages build scripts
Stars: ✭ 479 (+393.81%)
Mutual labels:  alpine-linux
Pmbootstrap
Repository has been moved! https://postmarketos.org/move.html#/pmbootstrap 🚚 🚚 🚚
Stars: ✭ 1,010 (+941.24%)
Mutual labels:  alpine-linux
Alpine Erlang
An alpine image with Erlang installed, intended for releases
Stars: ✭ 73 (-24.74%)
Mutual labels:  alpine-linux
Docker Fail2ban
Fail2ban Docker image based on Alpine Linux
Stars: ✭ 263 (+171.13%)
Mutual labels:  alpine-linux
Apk Tools
[MIRROR] Alpine package manager
Stars: ✭ 92 (-5.15%)
Mutual labels:  alpine-linux
Docker Flarum
Flarum Docker image based on Alpine Linux
Stars: ✭ 43 (-55.67%)
Mutual labels:  alpine-linux
Docker Rtorrent Rutorrent
rTorrent and ruTorrent Docker image based on Alpine Linux
Stars: ✭ 75 (-22.68%)
Mutual labels:  alpine-linux
Docker Alpine
Docker containers running Alpine Linux and s6 for process management. Solid, reliable containers.
Stars: ✭ 574 (+491.75%)
Mutual labels:  alpine-linux
Jekyll Docker
⛴ Docker images, and CI builders for Jekyll.
Stars: ✭ 804 (+728.87%)
Mutual labels:  alpine-linux
Alpine Strongswan Vpn
Dockerfile and related configuration for setting up a roadwarrior IKEv2-based VPN
Stars: ✭ 74 (-23.71%)
Mutual labels:  alpine-linux
Dockerfiles
Discontinued. Fork at your will.
Stars: ✭ 384 (+295.88%)
Mutual labels:  alpine-linux
Apk File
Search apk package contents via the command line.
Stars: ✭ 89 (-8.25%)
Mutual labels:  alpine-linux
Docker
LibreNMS Docker image based on Alpine Linux and Nginx
Stars: ✭ 283 (+191.75%)
Mutual labels:  alpine-linux
Socat
Run socat command in alpine container
Stars: ✭ 53 (-45.36%)
Mutual labels:  alpine-linux
Alpine Pkg Glibc
A glibc compatibility layer package for Alpine Linux
Stars: ✭ 1,324 (+1264.95%)
Mutual labels:  alpine-linux
Docker Oidc Proxy
Docker Image built on Alpine Linux for secure OpenID Connect (OIDC) proxy authentication
Stars: ✭ 91 (-6.19%)
Mutual labels:  alpine-linux
Docker Ruby Node
🐳 Alpine Docker Image with latest versions of Ruby, Node.js and yarn installed. This Docker Image is actively maintained and updated regularly.
Stars: ✭ 74 (-23.71%)
Mutual labels:  alpine-linux

About this container

Docker Pulls Docker Stars GitHub Stars Apache licensed

This container runs chrony on Alpine Linux.

chrony is a versatile implementation of the Network Time Protocol (NTP). It can synchronise the system clock with NTP servers, reference clocks (e.g. GPS receiver), and manual input using wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) server and peer to provide a time service to other computers in the network.

Supported Architectures

Architectures officially supported by this Docker container. Simply pulling this container from Docker Hub should retrieve the correct image for your architecture.

Linux x86-64 ARMv8 64-bit IBM POWER8 IBM Z Systems Linux x86/i686 ARMv7 32-bit ARMv6 32-bit

How to Run this container

With the Docker CLI

Pull and run -- it's this simple.

# pull from docker hub
$> docker pull cturra/ntp

# run ntp
$> docker run --name=ntp            \
              --restart=always      \
              --detach              \
              --publish=123:123/udp \
              cturra/ntp

# OR run ntp with higher security (default behaviour of run.sh and docker-compose).
$> docker run --name=ntp                           \
              --restart=always                     \
              --detach                             \
              --publish=123:123/udp                \
              --read-only                          \
              --tmpfs=/etc/chrony:rw,mode=1750     \
              --tmpfs=/run/chrony:rw,mode=1750     \
              --tmpfs=/var/lib/chrony:rw,mode=1750 \
              cturra/ntp

With Docker Compose

Using the docker-compose.yml file included in this git repo, you can build the container yourself (should you choose to). *Note: this docker-compose files uses the 3.4 compose format, which requires Docker Engine release 17.09.0+

# pull from docker hub
$> docker pull cturra/ntp

# build ntp
$> docker-compose build ntp

# run ntp
$> docker-compose up -d ntp

# (optional) check the ntp logs
$> docker-compose logs ntp

From a CLI

Using the vars file in this git repo, you can update any of the variables to reflect your environment. Once updated, simply execute the build then run scripts.

# build ntp
$> ./build.sh

# run ntp
$> ./run.sh

Configure NTP Servers

By default, this container uses CloudFlare's time server (time.cloudflare.com). If you'd like to use one or more different NTP server(s), you can pass this container an NTP_SERVERS environment variable. This can be done by updating the vars, docker-compose.yml files or manually passing --env=NTP_SERVERS="..." to docker run.

Below are some examples of how to configure common NTP Servers.

Do note, to configure more than one server, you must use a comma delimited list WITHOUT spaces.

# (default) cloudflare
NTP_SERVERS="time.cloudflare.com"

# google
NTP_SERVERS="time1.google.com,time2.google.com,time3.google.com,time4.google.com"

# alibaba
NTP_SERVERS="ntp1.aliyun.com,ntp2.aliyun.com,ntp3.aliyun.com,ntp4.aliyun.com"

Testing your NTP Container

From any machine that has ntpdate you can query your new NTP container with the follow command:

$> ntpdate -q <DOCKER_HOST_IP>

Here is a sample output from my environment:

$> ntpdate -q 10.13.13.9
server 10.13.1.109, stratum 4, offset 0.000642, delay 0.02805
14 Mar 19:21:29 ntpdate[26834]: adjust time server 10.13.13.109 offset 0.000642 sec

If you see a message, like the following, it's likely the clock is not yet synchronized. You should see this go away if you wait a bit longer and query again.

$> ntpdate -q 10.13.13.9
server 10.13.13.9, stratum 16, offset 0.005689, delay 0.02837
11 Dec 09:47:53 ntpdate[26030]: no server suitable for synchronization found

To see details on the ntp status of your container, you can check with the command below on your docker host:

$> docker exec ntp chronyc tracking
Reference ID    : D8EF2300 (time1.google.com)
Stratum         : 2
Ref time (UTC)  : Sun Mar 15 04:33:30 2020
System time     : 0.000054161 seconds slow of NTP time
Last offset     : -0.000015060 seconds
RMS offset      : 0.000206534 seconds
Frequency       : 5.626 ppm fast
Residual freq   : -0.001 ppm
Skew            : 0.118 ppm
Root delay      : 0.022015510 seconds
Root dispersion : 0.001476757 seconds
Update interval : 1025.2 seconds
Leap status     : Normal

Here is how you can see a peer list to verify the state of each ntp source configured:

$> docker exec ntp chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ time.cloudflare.com           3  10   377   404   -623us[ -623us] +/-   24ms
^* time1.google.com              1  10   377  1023   +259us[ +244us] +/-   11ms

Finally, if you'd like to see statistics about the collected measurements of each ntp source configured:

$> docker exec ntp chronyc sourcestats
210 Number of sources = 2
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
time.cloudflare.com        35  18  139m     +0.014      0.141   -662us   530us
time1.google.com           33  13  128m     -0.007      0.138   +318us   460us

Buy Me A Coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].