Skip to content

Commit 72ceb6e

Browse files
Merge pull request #20905 from Odilhao/issue-20585-entrypoint
Add support for Entrypoint in quadlet
2 parents c04ed59 + 7cc6501 commit 72ceb6e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

docs/source/markdown/podman-systemd.unit.5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Valid options for `[Container]` are listed below:
168168
| Environment=foo=bar | --env foo=bar |
169169
| EnvironmentFile=/tmp/env | --env-file /tmp/env |
170170
| EnvironmentHost=true | --env-host |
171+
| Entrypoint=/foo.sh | --entrypoint=/foo.sh |
171172
| Exec=/usr/bin/command | Command after image specification - /usr/bin/command |
172173
| ExposeHostPort=50-59 | --expose 50-59 |
173174
| 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
320321

321322
Use the host environment inside of the container.
322323

324+
#### `Entrypoint=`
325+
326+
Override the default ENTRYPOINT from the image.
327+
Equivalent to the Podman `--entrypoint` option.
328+
Specify multi option commands in the form of a json string.
329+
323330
### `Exec=`
324331

325332
If this is set then it defines what command line to run in the container. If it is not set the

pkg/systemd/quadlet/quadlet.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const (
7272
KeyEnvironment = "Environment"
7373
KeyEnvironmentFile = "EnvironmentFile"
7474
KeyEnvironmentHost = "EnvironmentHost"
75+
KeyEntrypoint = "Entrypoint"
7576
KeyExec = "Exec"
7677
KeyExitCodePropagation = "ExitCodePropagation"
7778
KeyExposeHostPort = "ExposeHostPort"
@@ -180,6 +181,7 @@ var (
180181
KeyEnvironment: true,
181182
KeyEnvironmentFile: true,
182183
KeyEnvironmentHost: true,
184+
KeyEntrypoint: true,
183185
KeyExec: true,
184186
KeyExposeHostPort: true,
185187
KeyGIDMap: true,
@@ -628,6 +630,11 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
628630
podman.addf("--shm-size=%s", shmSize)
629631
}
630632

633+
entrypoint, hasEntrypoint := container.Lookup(ContainerGroup, KeyEntrypoint)
634+
if hasEntrypoint {
635+
podman.addf("--entrypoint=%s", entrypoint)
636+
}
637+
631638
sysctl := container.LookupAllStrv(ContainerGroup, KeySysctl)
632639
for _, sysctlItem := range sysctl {
633640
podman.addf("--sysctl=%s", sysctlItem)

test/e2e/quadlet/entrypoint.container

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## assert-podman-final-args localhost/imagename
2+
## assert-podman-args "--entrypoint=top"
3+
4+
[Container]
5+
Image=localhost/imagename
6+
Entrypoint=top

test/e2e/quadlet_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ BOGUS=foo
765765
Entry("env-host-false.container", "env-host-false.container", 0, ""),
766766
Entry("env-host.container", "env-host.container", 0, ""),
767767
Entry("env.container", "env.container", 0, ""),
768+
Entry("entrypoint.container", "entrypoint.container", 0, ""),
768769
Entry("escapes.container", "escapes.container", 0, ""),
769770
Entry("exec.container", "exec.container", 0, ""),
770771
Entry("health.container", "health.container", 0, ""),

0 commit comments

Comments
 (0)