diff --git a/daemon/create.go b/daemon/create.go index bf8c90e3ef..bf8f59c416 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -201,7 +201,9 @@ func (daemon *Daemon) setRWLayer(container *container.Container) error { } layerID = img.RootFS.ChainID() } - rwLayer, err := daemon.layerStore.CreateRWLayer(container.ID, layerID, container.MountLabel, daemon.setupInitLayer, container.HostConfig.StorageOpt) + + rwLayer, err := daemon.layerStore.CreateRWLayer(container.ID, layerID, container.MountLabel, daemon.getLayerInit(), container.HostConfig.StorageOpt) + if err != nil { return err } diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index 4ed0594c6a..ba0c423aaf 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -779,6 +779,10 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *Config) e return nil } +func (daemon *Daemon) getLayerInit() func(string) error { + return daemon.setupInitLayer +} + // setupInitLayer populates a directory with mountpoints suitable // for bind-mounting things into the container. // diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index f75006441a..c65c597ac1 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -61,6 +61,10 @@ func setupInitLayer(initLayer string, rootUID, rootGID int) error { return nil } +func (daemon *Daemon) getLayerInit() func(string) error { + return nil +} + func checkKernel() error { return nil } diff --git a/layer/layer_store.go b/layer/layer_store.go index a587b01abf..f6e8db4d97 100644 --- a/layer/layer_store.go +++ b/layer/layer_store.go @@ -586,7 +586,7 @@ func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc Mou // then the initID should be randomly generated. initID := fmt.Sprintf("%s-init", graphID) - if err := ls.driver.Create(initID, parent, mountLabel, storageOpt); err != nil { + if err := ls.driver.CreateReadWrite(initID, parent, mountLabel, storageOpt); err != nil { return "", err } p, err := ls.driver.Get(initID, "")