2019-04-10 14:59:33 +00:00
|
|
|
package rootless // import "github.com/docker/docker/rootless"
|
2018-10-15 07:52:53 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
2019-04-19 07:53:58 +00:00
|
|
|
const (
|
|
|
|
// RootlessKitDockerProxyBinary is the binary name of rootlesskit-docker-proxy
|
|
|
|
RootlessKitDockerProxyBinary = "rootlesskit-docker-proxy"
|
|
|
|
)
|
|
|
|
|
2018-10-15 07:52:53 +00:00
|
|
|
var (
|
2019-04-19 07:53:58 +00:00
|
|
|
runningWithRootlessKit bool
|
|
|
|
runningWithRootlessKitOnce sync.Once
|
2018-10-15 07:52:53 +00:00
|
|
|
)
|
|
|
|
|
2019-04-19 07:53:58 +00: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 07:52:53 +00:00
|
|
|
})
|
2019-04-19 07:53:58 +00:00
|
|
|
return runningWithRootlessKit
|
2018-10-15 07:52:53 +00:00
|
|
|
}
|