mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Add support for Entrypoint in quadlet
This PR closes #20585 Add Inital support for Entrypoint on quadlets Add Bats Tests for Entrypoint Updates the documentation with one example to use the Entrypoint option Signed-off-by: Odilon Sousa <osousa@redhat.com>
This commit is contained in:
@ -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
|
||||
|
@ -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)
|
||||
|
@ -1467,4 +1467,22 @@ EOF
|
||||
|
||||
run_podman rmi $(pause_image)
|
||||
}
|
||||
@test "quadlet - entrypoint" {
|
||||
local quadlet_file=$PODMAN_TMPDIR/basic_$(random_string).container
|
||||
cat > $quadlet_file <<EOF
|
||||
[Container]
|
||||
Image=$IMAGE
|
||||
Entrypoint=top
|
||||
EOF
|
||||
|
||||
run_quadlet "$quadlet_file"
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Create a container based on that
|
||||
run_podman container inspect --format '{{index .Args}}' $QUADLET_CONTAINER_NAME
|
||||
is "$output" "[top]"
|
||||
|
||||
service_cleanup $QUADLET_SERVICE_NAME failed
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
Reference in New Issue
Block a user