summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-18 23:51:12 +0100
committerGitHub <noreply@github.com>2021-11-18 23:51:12 +0100
commit319d3fba6d86dff7b19c5315bbe3ba0b67a97c81 (patch)
tree0db6ef4e6ba9bcfd178017ea63d3c2989fbd6aa9 /libpod/oci_conmon_linux.go
parentc26af00c4bf5aec458868b5afd44e7a88ddcf46d (diff)
parent0dae50f1d3af16e625ca7e2f272fb2ce63682c83 (diff)
downloadpodman-319d3fba6d86dff7b19c5315bbe3ba0b67a97c81.tar.gz
podman-319d3fba6d86dff7b19c5315bbe3ba0b67a97c81.tar.bz2
podman-319d3fba6d86dff7b19c5315bbe3ba0b67a97c81.zip
Merge pull request #12354 from Luap99/exit-command
Do not store the exit command in container config
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index e007d0b92..bcf45ec8d 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -30,6 +30,7 @@ import (
"github.com/containers/podman/v3/pkg/checkpoint/crutils"
"github.com/containers/podman/v3/pkg/errorhandling"
"github.com/containers/podman/v3/pkg/rootless"
+ "github.com/containers/podman/v3/pkg/specgenutil"
"github.com/containers/podman/v3/pkg/util"
"github.com/containers/podman/v3/utils"
"github.com/containers/storage/pkg/homedir"
@@ -1074,11 +1075,15 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co
args = append(args, "--no-pivot")
}
- if len(ctr.config.ExitCommand) > 0 {
- args = append(args, "--exit-command", ctr.config.ExitCommand[0])
- for _, arg := range ctr.config.ExitCommand[1:] {
- args = append(args, []string{"--exit-command-arg", arg}...)
- }
+ exitCommand, err := specgenutil.CreateExitCommandArgs(ctr.runtime.storageConfig, ctr.runtime.config, logrus.IsLevelEnabled(logrus.DebugLevel), ctr.AutoRemove(), false)
+ if err != nil {
+ return 0, err
+ }
+ exitCommand = append(exitCommand, ctr.config.ID)
+
+ args = append(args, "--exit-command", exitCommand[0])
+ for _, arg := range exitCommand[1:] {
+ args = append(args, []string{"--exit-command-arg", arg}...)
}
// Pass down the LISTEN_* environment (see #10443).