Merge pull request #3405 from dm0-/docker

Backport patch to fix volume labels
This commit is contained in:
David Michael 2018-09-06 17:45:00 -04:00 committed by GitHub
commit 2ec770a8f2
4 changed files with 43 additions and 2 deletions

View File

@ -76,7 +76,9 @@ RESTRICT="installsources strip"
S="${WORKDIR}/${P}/src/${COREOS_GO_PACKAGE}"
ENGINE_PATCHES=()
ENGINE_PATCHES=(
"${FILESDIR}/${P}-fix-mount-labels.patch"
)
# see "contrib/check-config.sh" from upstream's sources
CONFIG_CHECK="

View File

@ -0,0 +1,39 @@
From 27d9030b2371aa4a6b167fded6b8dc25987a0af7 Mon Sep 17 00:00:00 2001
From: Kir Kolyshkin <kolyshkin@gmail.com>
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 <kolyshkin@gmail.com>
---
daemon/volumes.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemon/volumes.go b/daemon/volumes.go
index d1c98d0a4fae..ad3c96a94599 100644
--- a/daemon/volumes.go
+++ b/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)
}

View File

@ -11,7 +11,7 @@ KEYWORDS="amd64 arm64"
# Explicitly list all packages that will be built into the image.
RDEPEND="
=app-emulation/docker-18.06.1
=app-emulation/docker-18.06.1-r1
=app-emulation/containerd-1.1.2
=app-emulation/docker-proxy-0.8.0_p20180709
=app-emulation/docker-runc-1.0.0_rc5_p19