diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-08-29 10:28:40 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-29 16:25:20 +0000 |
commit | ecf84390ef8fbcdf31d6429f47cd15f12d83faf4 (patch) | |
tree | bea69bfc5f879ced1ed2c9e500566a8c98085aaa /cmd/podman | |
parent | d8c2962188a8c6900e609c0dced5a662fcc18272 (diff) | |
download | podman-ecf84390ef8fbcdf31d6429f47cd15f12d83faf4.tar.gz podman-ecf84390ef8fbcdf31d6429f47cd15f12d83faf4.tar.bz2 podman-ecf84390ef8fbcdf31d6429f47cd15f12d83faf4.zip |
rootless: show an error when stats is used
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1371
Approved by: rhatdan
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/main.go | 1 | ||||
-rw-r--r-- | cmd/podman/stats.go | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 538eaaac2..c82c018fa 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -35,6 +35,7 @@ var cmdsNotRequiringRootless = map[string]bool{ "pause": true, "unpause": true, "search": true, + "stats": true, "stop": true, "top": true, } diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index 45868e8d7..2d6a2a3d2 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os" "reflect" "strings" "time" @@ -62,6 +63,10 @@ func statsCmd(c *cli.Context) error { return err } + if os.Getuid() != 0 { + return errors.New("stats is not supported for rootless containers") + } + all := c.Bool("all") latest := c.Bool("latest") ctr := 0 |