discovery_unix.go 852 B

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