mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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 commit5bbf5cc
and later broken by commite4b6adc
, 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 <kolyshkin@gmail.com>
This commit is contained in:
parent
64b7575802
commit
27d9030b23
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue