2019-04-10 10:59:33 -04:00
|
|
|
package rootless // import "github.com/docker/docker/rootless"
|
2018-10-15 03:52:53 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
2019-04-19 03:53:58 -04:00
|
|
|
const (
|
|
|
|
// RootlessKitDockerProxyBinary is the binary name of rootlesskit-docker-proxy
|
|
|
|
RootlessKitDockerProxyBinary = "rootlesskit-docker-proxy"
|
|
|
|
)
|
|
|
|
|
2018-10-15 03:52:53 -04:00
|
|
|
var (
|
2019-04-19 03:53:58 -04:00
|
|
|
runningWithRootlessKit bool
|
|
|
|
runningWithRootlessKitOnce sync.Once
|
2018-10-15 03:52:53 -04:00
|
|
|
)
|
|
|
|
|
2019-04-19 03:53:58 -04:00
|
|
|
// RunningWithRootlessKit returns true if running under RootlessKit namespaces.
|
|
|
|
func RunningWithRootlessKit() bool {
|
|
|
|
runningWithRootlessKitOnce.Do(func() {
|
|
|
|
u := os.Getenv("ROOTLESSKIT_STATE_DIR")
|
|
|
|
runningWithRootlessKit = u != ""
|
2018-10-15 03:52:53 -04:00
|
|
|
})
|
2019-04-19 03:53:58 -04:00
|
|
|
return runningWithRootlessKit
|
2018-10-15 03:52:53 -04:00
|
|
|
}
|