From 5611f127a7028c40a2ba59a1a09f92cdfe99f2ba Mon Sep 17 00:00:00 2001 From: Ryan Simmen Date: Tue, 3 Oct 2017 17:47:55 -0400 Subject: [PATCH] Windows Daemon should respect DOCKER_TMPDIR Signed-off-by: Ryan Simmen --- daemon/daemon.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 23c7b20199..e844355f77 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -555,7 +555,17 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe if err != nil { return nil, fmt.Errorf("Unable to get the full path to the TempDir (%s): %s", tmp, err) } - os.Setenv("TMPDIR", realTmp) + if runtime.GOOS == "windows" { + if _, err := os.Stat(realTmp); err != nil && os.IsNotExist(err) { + if err := system.MkdirAll(realTmp, 0700, ""); err != nil { + return nil, fmt.Errorf("Unable to create the TempDir (%s): %s", realTmp, err) + } + } + os.Setenv("TEMP", realTmp) + os.Setenv("TMP", realTmp) + } else { + os.Setenv("TMPDIR", realTmp) + } d := &Daemon{ configStore: config,