aboutsummaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-23 14:18:12 -0500
committerMatthew Heon <mheon@redhat.com>2022-03-30 15:36:05 -0400
commita4203bd66cf802449cf9dda9498efa83fa0302e8 (patch)
tree944ea7bf9851633f354b176feef494ce38097e0c /pkg/specgen
parentb362367efb7ecbe8aadeac3f5f4d5d17fe27862b (diff)
downloadpodman-a4203bd66cf802449cf9dda9498efa83fa0302e8.tar.gz
podman-a4203bd66cf802449cf9dda9498efa83fa0302e8.tar.bz2
podman-a4203bd66cf802449cf9dda9498efa83fa0302e8.zip
Set systemd mode if entrypoint begins with /bin/sh -c
Fixes: https://github.com/containers/podman/issues/13324 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container_create.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index a7a7353d0..28c31c7eb 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -267,7 +267,16 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
"/usr/sbin/init": true,
"/usr/local/sbin/init": true,
}
- if useSystemdCommands[command[0]] || (filepath.Base(command[0]) == "systemd") {
+ // Grab last command incase this is launched from a shell
+ cmd := command
+ if len(command) > 2 {
+ // Podman build will add "/bin/sh" "-c" to
+ // Entrypoint. Remove and search for systemd
+ if command[0] == "/bin/sh" && command[1] == "-c" {
+ cmd = command[2:]
+ }
+ }
+ if useSystemdCommands[cmd[0]] || (filepath.Base(cmd[0]) == "systemd") {
useSystemd = true
}
}