pkg/rootless: move to daemon/internal

This package is used internally by the daemon, and was only used out
side of the daemon by pkg/plugins (for which we still need to look
where it should be kept).

Making it internal because it's trivial to implement if needed by
anyone. The only reason it's a package is to keep it central, and
to make it easier to discover where we have rootlesskit-specific
codepaths in our codebase.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-07-28 20:56:42 +02:00
parent 1e0531c8d5
commit d761d9d358
7 changed files with 8 additions and 7 deletions

View File

@@ -3,10 +3,10 @@
package plugins
import (
"os"
"path/filepath"
"github.com/docker/docker/pkg/homedir"
"github.com/docker/docker/pkg/rootless"
)
func rootlessConfigPluginsPath() string {
@@ -25,7 +25,8 @@ func rootlessLibPluginsPath() string {
// specsPaths is the non-Windows implementation of [SpecsPaths].
func specsPaths() []string {
if rootless.RunningWithRootlessKit() {
// TODO(thaJeztah): switch back to daemon/internal/rootless.RunningWithRootlessKit if this package moves internal to the daemon.
if os.Getenv("ROOTLESSKIT_STATE_DIR") != "" {
return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
}
return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}

View File

@@ -1,8 +0,0 @@
package rootless
import "os"
// RunningWithRootlessKit returns true if running under RootlessKit namespaces.
func RunningWithRootlessKit() bool {
return os.Getenv("ROOTLESSKIT_STATE_DIR") != ""
}