Need to create bind mount volume if it does not exist.

In order to be consistent on creation of volumes for bind mounts
we need to create the source directory if it does not exist and the
user specified he wants it relabeled.

Can not do this lower down the stack, since we are not passing in the
mode fields.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: 322cc99c6962ecb56be3107061eb7f61364d05f8
Component: engine
This commit is contained in:
Dan Walsh
2016-06-02 07:14:17 -04:00
parent ce5b5efc4f
commit ab8e2e8aee
3 changed files with 12 additions and 13 deletions
-6
View File
@@ -11,7 +11,6 @@ import (
"github.com/docker/docker/volume"
"github.com/docker/engine-api/types"
containertypes "github.com/docker/engine-api/types/container"
"github.com/opencontainers/runc/libcontainer/label"
)
var (
@@ -148,11 +147,6 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo
}
}
if label.RelabelNeeded(bind.Mode) {
if err := label.Relabel(bind.Source, container.MountLabel, label.IsShared(bind.Mode)); err != nil {
return err
}
}
binds[bind.Destination] = true
mountPoints[bind.Destination] = bind
}
+1 -1
View File
@@ -20,7 +20,7 @@ func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, er
if err := daemon.lazyInitializeVolume(c.ID, m); err != nil {
return nil, err
}
path, err := m.Setup()
path, err := m.Setup(c.MountLabel)
if err != nil {
return nil, err
}