From 7a491b230136574d4bd611862c6ab842493955a7 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 30 Aug 2018 15:32:14 -0700 Subject: [PATCH] Fix relabeling local volume source dir In case a volume is specified via Mounts API, and SELinux is enabled, the following error happens on container start: > $ docker volume create testvol > $ docker run --rm --mount source=testvol,target=/tmp busybox true > docker: Error response from daemon: error setting label on mount > source '': no such file or directory. The functionality to relabel the source of a local mount specified via Mounts API was introduced in commit 5bbf5cc and later broken by commit e4b6adc, which removed setting mp.Source field. With the current data structures, the host dir is already available in v.Mountpoint, so let's just use it. Fixes: e4b6adc Signed-off-by: Kir Kolyshkin Upstream-commit: 4032b6778df39f53fda0e6e54f0256c9a3b1d618 Component: engine --- components/engine/daemon/volumes.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/engine/daemon/volumes.go b/components/engine/daemon/volumes.go index d1c98d0a4fa..ad3c96a9459 100644 --- a/components/engine/daemon/volumes.go +++ b/components/engine/daemon/volumes.go @@ -210,6 +210,8 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo mp.Name = v.Name mp.Driver = v.Driver + // need to selinux-relabel local mounts + mp.Source = v.Mountpoint if mp.Driver == volume.DefaultDriverName { setBindModeIfNull(mp) }