docker-compose 部署ntp时间同步服务(tmpfs例子)
一、部署ntp服务
version: '2'
services:
ntp:
image: cturra/ntp
container_name: ntp
restart: always
ports:
- '123:123/udp'
environment:
- NTP_SERVERS="ntp.aliyun.com"
tmpfs:
- '/etc/chrony:rw,mode=1750'
- '/var/lib/chrony:rw,mode=1750'
- '/run/chrony:rw,mode=1750'
docker-compose up -d
docker-compose ps
二、测试
docker-compose exec ntp chronyc sources