From c3fb546053d89dceb0ad6319fb382a0444f0a9a1 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 10 Feb 2015 13:45:50 -0500 Subject: [PATCH] Check nil volume on mount init Fixes #10685 panic in some cases. Signed-off-by: Brian Goff Upstream-commit: 7122b6643e4124db3d37b3b46f4741a97ba03611 Component: engine --- components/engine/daemon/volumes.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/engine/daemon/volumes.go b/components/engine/daemon/volumes.go index a367798786..acc35a2675 100644 --- a/components/engine/daemon/volumes.go +++ b/components/engine/daemon/volumes.go @@ -89,9 +89,10 @@ func (m *Mount) initialize() error { // Make sure we remove these old volumes we don't actually want now. // Ignore any errors here since this is just cleanup, maybe someone volumes-from'd this volume - v := m.container.daemon.volumes.Get(hostPath) - v.RemoveContainer(m.container.ID) - m.container.daemon.volumes.Delete(v.Path) + if v := m.container.daemon.volumes.Get(hostPath); v != nil { + v.RemoveContainer(m.container.ID) + m.container.daemon.volumes.Delete(v.Path) + } } // This is the full path to container fs + mntToPath