Merge pull request #20905 from Odilhao/issue-20585-entrypoint

Add support for Entrypoint in quadlet
This commit is contained in:
openshift-merge-bot[bot] 2023-12-06 14:13:03 +00:00 committed by GitHub
commit 72ceb6ee82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -0,0 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--entrypoint=top"
[Container]
Image=localhost/imagename
Entrypoint=top

View File

@ -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, ""),