From 26517a01610215d218ad7236a5b5d44539220d12 Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Thu, 2 Feb 2017 11:22:12 -0800 Subject: [PATCH] Add Windows specific exec root for plugins. Fixes #30572 Signed-off-by: Anusha Ragunathan --- daemon/daemon.go | 2 +- daemon/daemon_linux.go | 8 ++++++++ daemon/daemon_windows.go | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 5e310f321c..600c234ec1 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -569,7 +569,7 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot // Plugin system initialization should happen before restore. Do not change order. d.pluginManager, err = plugin.NewManager(plugin.ManagerConfig{ Root: filepath.Join(config.Root, "plugins"), - ExecRoot: "/run/docker/plugins", // possibly needs fixing + ExecRoot: getPluginExecRoot(config.Root), Store: d.PluginStore, Executor: containerdRemote, RegistryService: registryService, diff --git a/daemon/daemon_linux.go b/daemon/daemon_linux.go index 9bdf6e2b79..5faf533fde 100644 --- a/daemon/daemon_linux.go +++ b/daemon/daemon_linux.go @@ -12,6 +12,14 @@ import ( "github.com/docker/docker/pkg/mount" ) +// On Linux, plugins use a static path for storing execution state, +// instead of deriving path from daemon's exec-root. This is because +// plugin socket files are created here and they cannot exceed max +// path length of 108 bytes. +func getPluginExecRoot(root string) string { + return "/run/docker/plugins" +} + func (daemon *Daemon) cleanupMountsByID(id string) error { logrus.Debugf("Cleaning up old mountid %s: start.", id) f, err := os.Open("/proc/self/mountinfo") diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index 5ea9a4cb46..1c416bdc9c 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -3,6 +3,7 @@ package daemon import ( "fmt" "os" + "path/filepath" "strings" "github.com/Microsoft/hcsshim" @@ -37,6 +38,11 @@ const ( windowsMinCPUCount = 1 ) +// Windows has no concept of an execution state directory. So use config.Root here. +func getPluginExecRoot(root string) string { + return filepath.Join(root, "plugins") +} + func getBlkioWeightDevices(config *containertypes.HostConfig) ([]blkiodev.WeightDevice, error) { return nil, nil }