From 060f387c0b03373ab837f0de039dc061133842f8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 2 Aug 2019 12:36:54 +0200 Subject: [PATCH] Fix "no such file or directory" warning when unmounting IPC mount When cleaning up IPC mounts, the daemon could log a warning if the IPC mount was not found; ``` cleanup: failed to unmount IPC: umount /var/lib/docker/containers/90f408e26e205d30676655a08504dddc0d17f5713c1dd4654cf67ded7d3bbb63/mounts/shm, flags: 0x2: no such file or directory" ``` These warnings are safe to ignore, but can cause some confusion; `container.UnmountIpcMount()` already attempted to suppress these warnings, however, `mount.Unmount()` returns a `mountError`, which nests the original error, therefore detecting failed. This parch uses `errors.Cause()` to get the _underlying_ error to detect if it's a "is not exist". Signed-off-by: Sebastiaan van Stijn --- container/container_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container/container_unix.go b/container/container_unix.go index b5c9b66b58..3fc6c91e72 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -190,7 +190,7 @@ func (container *Container) UnmountIpcMount() error { if shmPath == "" { return nil } - if err = mount.Unmount(shmPath); err != nil && !os.IsNotExist(err) { + if err = mount.Unmount(shmPath); err != nil && !os.IsNotExist(errors.Cause(err)) { return err } return nil