rootless: show an error when stats is used

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1371
Approved by: rhatdan
This commit is contained in:
Giuseppe Scrivano 2018-08-29 10:28:40 +02:00 committed by Atomic Bot
parent d8c2962188
commit ecf84390ef
2 changed files with 6 additions and 0 deletions

View File

@ -35,6 +35,7 @@ var cmdsNotRequiringRootless = map[string]bool{
"pause": true,
"unpause": true,
"search": true,
"stats": true,
"stop": true,
"top": true,
}

View File

@ -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