Permalink
Browse files

main: honor XDG_RUNTIME_DIR for rootless containers

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information...
giuseppe authored and cyphar committed Jul 20, 2017
1 parent 13fa5d2 commit fdf85e35b3d4e45666b8fdb9d5f2d4dd5f911d28
Showing with 11 additions and 2 deletions.
  1. +10 −1 main.go
  2. +1 −1 man/runc.8.md
View
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{
View
@@ -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

0 comments on commit fdf85e3

Please sign in to comment.