summaryrefslogtreecommitdiff
path: root/pkg/spec/createconfig.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-13 22:55:52 +0100
committerGitHub <noreply@github.com>2019-02-13 22:55:52 +0100
commitdfc64e15d7f8b1715798fd68bd3ff74ae192b354 (patch)
tree28fff3097e5705623bc48670c67dee64a5296329 /pkg/spec/createconfig.go
parent29d9ccf38158235ef37e4f5c20ad152bb396e3b9 (diff)
parent9d4e7fe58b10c4130340a151a377cf7be8aaa810 (diff)
downloadpodman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.tar.gz
podman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.tar.bz2
podman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.zip
Merge pull request #2319 from mheon/unconditional_cleanup
Fix manual detach from containers to not wait for exit
Diffstat (limited to 'pkg/spec/createconfig.go')
-rw-r--r--pkg/spec/createconfig.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index f6c77d61c..8edab831f 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/namespaces"
- "github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/go-connections/nat"
@@ -340,7 +339,13 @@ func (c *CreateConfig) createExitCommand() []string {
if c.Syslog {
command = append(command, "--syslog")
}
- return append(command, []string{"container", "cleanup"}...)
+ command = append(command, []string{"container", "cleanup"}...)
+
+ if c.Rm {
+ command = append(command, "--rm")
+ }
+
+ return command
}
// GetContainerCreateOptions takes a CreateConfig and returns a slice of CtrCreateOptions
@@ -518,11 +523,9 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l
if c.CgroupParent != "" {
options = append(options, libpod.WithCgroupParent(c.CgroupParent))
}
- // For a rootless container always cleanup the storage/network as they
- // run in a different namespace thus not reusable when we restart.
- if c.Detach || rootless.IsRootless() {
- options = append(options, libpod.WithExitCommand(c.createExitCommand()))
- }
+
+ // Always use a cleanup process to clean up Podman after termination
+ options = append(options, libpod.WithExitCommand(c.createExitCommand()))
return options, nil
}