github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/pkg/plugins/discovery_unix.go (about)

     1  //go:build !windows
     2  
     3  package plugins // import "github.com/Prakhar-Agarwal-byte/moby/pkg/plugins"
     4  import (
     5  	"path/filepath"
     6  
     7  	"github.com/Prakhar-Agarwal-byte/moby/pkg/homedir"
     8  	"github.com/Prakhar-Agarwal-byte/moby/pkg/rootless"
     9  )
    10  
    11  func rootlessConfigPluginsPath() string {
    12  	if configHome, err := homedir.GetConfigHome(); err != nil {
    13  		return filepath.Join(configHome, "docker/plugins")
    14  	}
    15  	return "/etc/docker/plugins"
    16  }
    17  
    18  func rootlessLibPluginsPath() string {
    19  	if libHome, err := homedir.GetLibHome(); err == nil {
    20  		return filepath.Join(libHome, "docker/plugins")
    21  	}
    22  	return "/usr/lib/docker/plugins"
    23  }
    24  
    25  // specsPaths is the non-Windows implementation of [SpecsPaths].
    26  func specsPaths() []string {
    27  	if rootless.RunningWithRootlessKit() {
    28  		return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
    29  	}
    30  	return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
    31  }