From fe13f30f0fec297c6ee5d038025a849ece590af9 Mon Sep 17 00:00:00 2001 From: John Howard Date: Mon, 14 Aug 2017 11:00:10 -0700 Subject: [PATCH] Merge global storage options on create Signed-off-by: John Howard Upstream-commit: 932ae425e8a8aac86f70c249f3a0304101e83614 Component: engine --- components/engine/daemon/create.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/engine/daemon/create.go b/components/engine/daemon/create.go index cf61336597..5470836932 100644 --- a/components/engine/daemon/create.go +++ b/components/engine/daemon/create.go @@ -137,6 +137,23 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) ( container.HostConfig.StorageOpt = params.HostConfig.StorageOpt + // Fixes: https://github.com/moby/moby/issues/34074 and + // https://github.com/docker/for-win/issues/999. + // Merge the daemon's storage options if they aren't already present. We only + // do this on Windows as there's no effective sandbox size limit other than + // physical on Linux. + if runtime.GOOS == "windows" { + if container.HostConfig.StorageOpt == nil { + container.HostConfig.StorageOpt = make(map[string]string) + } + for _, v := range daemon.configStore.GraphOptions { + opt := strings.SplitN(v, "=", 2) + if _, ok := container.HostConfig.StorageOpt[opt[0]]; !ok { + container.HostConfig.StorageOpt[opt[0]] = opt[1] + } + } + } + // Set RWLayer for container after mount labels have been set if err := daemon.setRWLayer(container); err != nil { return nil, err