summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-08-29 10:24:50 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-29 16:25:20 +0000
commitd8c2962188a8c6900e609c0dced5a662fcc18272 (patch)
tree7d3fabb74ad7d0b63e5776d5a6475c05d58c81c4
parent86aefb5de25496ce8894bef73bec6e5d13fd3f47 (diff)
downloadpodman-d8c2962188a8c6900e609c0dced5a662fcc18272.tar.gz
podman-d8c2962188a8c6900e609c0dced5a662fcc18272.tar.bz2
podman-d8c2962188a8c6900e609c0dced5a662fcc18272.zip
rootless: show an error when pause/unpause are used
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1371 Approved by: rhatdan
-rw-r--r--cmd/podman/main.go2
-rw-r--r--cmd/podman/pause.go4
-rw-r--r--cmd/podman/unpause.go4
3 files changed, 10 insertions, 0 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 06d9308e0..538eaaac2 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -32,6 +32,8 @@ var cmdsNotRequiringRootless = map[string]bool{
"login": true,
"logout": true,
"kill": true,
+ "pause": true,
+ "unpause": true,
"search": true,
"stop": true,
"top": true,
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index 12ff747a7..e8a576599 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -25,6 +25,10 @@ var (
)
func pauseCmd(c *cli.Context) error {
+ if os.Getuid() != 0 {
+ return errors.New("pause is not supported for rootless containers")
+ }
+
runtime, err := libpodruntime.GetRuntime(c)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index d0c622b8a..d5b2732af 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -25,6 +25,10 @@ var (
)
func unpauseCmd(c *cli.Context) error {
+ if os.Getuid() != 0 {
+ return errors.New("unpause is not supported for rootless containers")
+ }
+
runtime, err := libpodruntime.GetRuntime(c)
if err != nil {
return errors.Wrapf(err, "could not get runtime")