main: honor XDG_RUNTIME_DIR for rootless containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
13fa5d2953
commit
fdf85e35b3
11
main.go
11
main.go
|
@ -61,6 +61,15 @@ func main() {
|
|||
}
|
||||
v = append(v, fmt.Sprintf("spec: %s", specs.Version))
|
||||
app.Version = strings.Join(v, "\n")
|
||||
|
||||
root := "/run/runc"
|
||||
if os.Geteuid() != 0 {
|
||||
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
|
||||
if runtimeDir != "" {
|
||||
root = runtimeDir + "/runc"
|
||||
}
|
||||
}
|
||||
|
||||
app.Flags = []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "debug",
|
||||
|
@ -78,7 +87,7 @@ func main() {
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Value: "/run/runc",
|
||||
Value: root,
|
||||
Usage: "root directory for storage of container state (this should be located in tmpfs)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
|
|
|
@ -50,7 +50,7 @@ value for "bundle" is the current directory.
|
|||
--debug enable debug output for logging
|
||||
--log value set the log file path where internal debug information is written (default: "/dev/null")
|
||||
--log-format value set the format used by logs ('text' (default), or 'json') (default: "text")
|
||||
--root value root directory for storage of container state (this should be located in tmpfs) (default: "/run/runc")
|
||||
--root value root directory for storage of container state (this should be located in tmpfs) (default: "/run/runc" or $XDG_RUNTIME_DIR/runc for rootless containers)
|
||||
--criu value path to the criu binary used for checkpoint and restore (default: "criu")
|
||||
--systemd-cgroup enable systemd cgroup support, expects cgroupsPath to be of form "slice:prefix:name" for e.g. "system.slice:runc:434234"
|
||||
--help, -h show help
|
||||
|
|
Loading…
Reference in New Issue