diff --git a/docs/source/markdown/podman-systemd.unit.5.md b/docs/source/markdown/podman-systemd.unit.5.md index 5bbc2b6974..269c7ffd3b 100644 --- a/docs/source/markdown/podman-systemd.unit.5.md +++ b/docs/source/markdown/podman-systemd.unit.5.md @@ -168,6 +168,7 @@ Valid options for `[Container]` are listed below: | Environment=foo=bar | --env foo=bar | | EnvironmentFile=/tmp/env | --env-file /tmp/env | | EnvironmentHost=true | --env-host | +| Entrypoint=/foo.sh | --entrypoint=/foo.sh | | Exec=/usr/bin/command | Command after image specification - /usr/bin/command | | ExposeHostPort=50-59 | --expose 50-59 | | GIDMap=0:10000:10 | --gidmap=0:10000:10 | @@ -320,6 +321,12 @@ This key may be used multiple times, and the order persists when passed to `podm Use the host environment inside of the container. +#### `Entrypoint=` + +Override the default ENTRYPOINT from the image. +Equivalent to the Podman `--entrypoint` option. +Specify multi option commands in the form of a json string. + ### `Exec=` If this is set then it defines what command line to run in the container. If it is not set the diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index 349d55bc79..c484ec66d0 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -72,6 +72,7 @@ const ( KeyEnvironment = "Environment" KeyEnvironmentFile = "EnvironmentFile" KeyEnvironmentHost = "EnvironmentHost" + KeyEntrypoint = "Entrypoint" KeyExec = "Exec" KeyExitCodePropagation = "ExitCodePropagation" KeyExposeHostPort = "ExposeHostPort" @@ -180,6 +181,7 @@ var ( KeyEnvironment: true, KeyEnvironmentFile: true, KeyEnvironmentHost: true, + KeyEntrypoint: true, KeyExec: true, KeyExposeHostPort: true, KeyGIDMap: true, @@ -628,6 +630,11 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse podman.addf("--shm-size=%s", shmSize) } + entrypoint, hasEntrypoint := container.Lookup(ContainerGroup, KeyEntrypoint) + if hasEntrypoint { + podman.addf("--entrypoint=%s", entrypoint) + } + sysctl := container.LookupAllStrv(ContainerGroup, KeySysctl) for _, sysctlItem := range sysctl { podman.addf("--sysctl=%s", sysctlItem) diff --git a/test/e2e/quadlet/entrypoint.container b/test/e2e/quadlet/entrypoint.container new file mode 100644 index 0000000000..035783500b --- /dev/null +++ b/test/e2e/quadlet/entrypoint.container @@ -0,0 +1,6 @@ +## assert-podman-final-args localhost/imagename +## assert-podman-args "--entrypoint=top" + +[Container] +Image=localhost/imagename +Entrypoint=top diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index a89107e13d..a4e76edccb 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -765,6 +765,7 @@ BOGUS=foo Entry("env-host-false.container", "env-host-false.container", 0, ""), Entry("env-host.container", "env-host.container", 0, ""), Entry("env.container", "env.container", 0, ""), + Entry("entrypoint.container", "entrypoint.container", 0, ""), Entry("escapes.container", "escapes.container", 0, ""), Entry("exec.container", "exec.container", 0, ""), Entry("health.container", "health.container", 0, ""),