Przeglądaj źródła

Merge pull request #30686 from anusha-ragunathan/windowsPath

Add Windows specific exec root for plugins.
Vincent Demeester 8 lat temu
rodzic
commit
eb6b972c49
3 zmienionych plików z 15 dodań i 1 usunięć
  1. 1 1
      daemon/daemon.go
  2. 8 0
      daemon/daemon_linux.go
  3. 6 0
      daemon/daemon_windows.go

+ 1 - 1
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,

+ 8 - 0
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")

+ 6 - 0
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
 }