From 391441c28baec698f0e3f42d88e116291e8a8e98 Mon Sep 17 00:00:00 2001 From: Shijiang Wei Date: Sun, 8 May 2016 00:20:24 +0800 Subject: [PATCH] fix LogConfig for containers created before docker 1.12 on daemon startup Signed-off-by: Shijiang Wei --- daemon/daemon.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/daemon/daemon.go b/daemon/daemon.go index 1c7ad12700..7dc1418753 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -286,6 +286,16 @@ func (daemon *Daemon) restore() error { logrus.Errorf("Failed to register container %s: %s", c.ID, err) continue } + + // The LogConfig.Type is empty if the container was created before docker 1.12 with default log driver. + // We should rewrite it to use the daemon defaults. + // Fixes https://github.com/docker/docker/issues/22536 + if c.HostConfig.LogConfig.Type == "" { + if err := daemon.mergeAndVerifyLogConfig(&c.HostConfig.LogConfig); err != nil { + logrus.Errorf("Failed to verify log config for container %s: %q", c.ID, err) + continue + } + } } var wg sync.WaitGroup var mapLock sync.Mutex