Docker logs was only closing the logger when the HTTP response writer received a close notification, however in non-follow mode the writer never receives a close. This means that the daemon would leak the file handle to the log, preventing the container from being removed on Windows (file in use error). This change explicitly closes the log when the end of stream is hit.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
This commit is contained in:
Stefan J. Wernli 2016-03-17 17:48:21 -07:00
Родитель 41c1c6501e
Коммит 4570cfd3ba
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -84,6 +84,7 @@ func (daemon *Daemon) ContainerLogs(containerName string, config *backend.Contai
case msg, ok := <-logs.Msg:
if !ok {
logrus.Debugf("logs: end stream")
logs.Close()
return nil
}
logLine := msg.Line