diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-05-29 22:43:07 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-05-29 22:53:51 -0400 |
commit | 48e35f7da70c24edd339bf29b83c427c48afcaab (patch) | |
tree | d56d148606c64954d7444e9dd03eb66c6d1c1aff | |
parent | f456825fe8783d84e23a5cd291c637b3c3ed53dd (diff) | |
download | podman-48e35f7da70c24edd339bf29b83c427c48afcaab.tar.gz podman-48e35f7da70c24edd339bf29b83c427c48afcaab.tar.bz2 podman-48e35f7da70c24edd339bf29b83c427c48afcaab.zip |
We can't pause rootless containers during cp
Rootless containers can't be paused (no CGroups, so no freezer).
We could try and emulate this with a SIGSTOP to all PIDs in the
container, but that's inherently racy, so let's avoid it for now.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
-rw-r--r-- | cmd/podman/cp.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go index a0677071d..406337955 100644 --- a/cmd/podman/cp.go +++ b/cmd/podman/cp.go @@ -13,6 +13,7 @@ import ( "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/rootless" "github.com/containers/storage" "github.com/containers/storage/pkg/archive" "github.com/containers/storage/pkg/chrootarchive" @@ -95,7 +96,12 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin } defer ctr.Unmount(false) - if pause { + // We can't pause rootless containers. + if pause && rootless.IsRootless() { + logrus.Warnf("Cannot pause rootless containers - pause option will be ignored") + } + + if pause && !rootless.IsRootless() { if err := ctr.Pause(); err != nil { // An invalid state error is fine. // The container isn't running or is already paused. |