summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-29 14:45:46 +0200
committerGitHub <noreply@github.com>2022-03-29 14:45:46 +0200
commit83d0729146dc4616e180c8d36ffd90de093b8617 (patch)
tree87762cd20d3e2962d69c5c5ee9a003e2af035625 /pkg
parent784ec5d251a3e36815e3f807871b517c9e3fdf78 (diff)
parentcdf74f20820a578ea515e67b00a13714ff8bd6f2 (diff)
downloadpodman-83d0729146dc4616e180c8d36ffd90de093b8617.tar.gz
podman-83d0729146dc4616e180c8d36ffd90de093b8617.tar.bz2
podman-83d0729146dc4616e180c8d36ffd90de093b8617.zip
Merge pull request #13619 from rhatdan/systemd
Set systemd mode if entrypoint begins with /bin/sh -c
Diffstat (limited to 'pkg')
-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 8ab0eae5a..a014f5047 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -304,7 +304,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
}
}