重启docker service时为什么一般情况下不影响已经运行的容器?

如果是所示,这是docker自身的一个属性决定,该属性默认使true,因此当我们执行systemctl docker restart时已经运行的容器未受影响。

原文在: https://docs.docker.com/config/containers/live-restore/

中文大意‘:/etc/docker/daemon.json配置文件中设置了

{
  "live-restore": true
}

在升级小版本或者重启时,只要不改变daemon-level级别参数,是不会影响已运行容器的

Live restore during upgrades

Live restore allows you to keep containers running across Docker daemon updates, but is only supported when installing patch releases (YY.MM.x), not for major (YY.MM) daemon upgrades.

If you skip releases during an upgrade, the daemon may not restore its connection to the containers. If the daemon can’t restore the connection, it cannot manage the running containers and you must stop them manually.
Live restore upon restart

The live restore option only works to restore containers if the daemon options, such as bridge IP addresses and graph driver, did not change. If any of these daemon-level configuration options have changed, the live restore may not work and you may need to manually stop the container
特别注意不是所有情况下重启docker服务都不影响已运行容器,而是当不改变特定参数情况下,才不影响。

你可能感兴趣的:(go,docker,docker,容器,运维)