فهرست منبع

Merge pull request #22575 from mountkin/fix-22536

fix LogConfig for containers created before docker 1.12 on daemon start
Sebastiaan van Stijn 9 سال پیش
والد
کامیت
6ba3d63a8c
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      daemon/daemon.go

+ 10 - 0
daemon/daemon.go

@@ -148,6 +148,16 @@ func (daemon *Daemon) restore() error {
 			logrus.Errorf("Failed to register container %s: %s", c.ID, err)
 			logrus.Errorf("Failed to register container %s: %s", c.ID, err)
 			continue
 			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 wg sync.WaitGroup
 	var mapLock sync.Mutex
 	var mapLock sync.Mutex