热加载docker配置,不停止已经运行的容器

由于容器运行时间长,起初没有对容器的控制台日志进行切割,导致docker控制台日志越来越大,所有需要 对控制台

第一步:查看生产Live Restore Enabled的值为false

# docker info |grep -i live
WARNING: bridge-nf-call-ip6tables is disabled
 Live Restore Enabled: false

第二步:将默认的Live Restore Enabled: false改为Live Restore Enabled: true,并加入日志切割

# vim /etc/docker/daemon.json 
{
  "data-root": "/data/docker",
  "log-driver":"json-file",
  "log-opts": {"max-size":"200m", "max-file":"3"},
  "live-restore": true
}

# systemctl reload docker
# docker info |grep -i live
WARNING: bridge-nf-call-ip6tables is disabled
 Live Restore Enabled: true

热重启docker:
# systemctl restart docker

 

第三步:还原Live Restore Enabled: false配置

# vim /etc/docker/daemon.json 
{
  "data-root": "/data/docker",
  "log-driver":"json-file",
  "log-opts": {"max-size":"200m", "max-file":"3"},
  "live-restore": false
}
# systemctl reload docker

 

posted @ 2021-06-09 12:05  缺个好听的昵称  阅读(492)  评论(0编辑  收藏  举报