containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
452 stars 12 forks source link

Correctly convert multi argument `entrypoint` #119

Open cgzones opened 1 week ago

cgzones commented 1 week ago

Currently a compose entrypoint of

/usr/bin/tini -- wait-for-it opensearch:9200 -- /docker-entrypoint.sh

gets translated into

Entrypoint=/usr/bin/tini -- wait-for-it opensearch:9200 -- /docker-entrypoint.sh

while it should be

Entrypoint=["/usr/bin/tini", "--", "wait-for-it opensearch:9200", "--", "/docker-entrypoint.sh"]

k9withabone commented 1 week ago

Huh, I thought podman run --entrypoint worked the same way as the ENTRYPOINT instruction in a Containerfile/Dockerfile (using the string form as an argument to /bin/sh -c), but after testing it out just now it seems that it doesn't.

Do you know how Docker Compose works with the different forms for entrypoint? Does it act like docker run --entrypoint (which presumably works the same as Podman), or like the ENTRYPOINT instruction (in which case the correct conversion would add "/bin/sh", "-c" to the beginning)? The Compose Specification is frustratingly vague on if the entrypoint string form can even contain multiple arguments.

As a workaround, you can use a list/array for the Compose service entrypoint as well:

services:
  foo:
    image: bar
    entrypoint: ["/usr/bin/tini", "--", "wait-for-it opensearch:9200", "--", "/docker-entrypoint.sh"]

Which converts to:

# foo.container
[Container]
Entrypoint=["/usr/bin/tini","--","wait-for-it opensearch:9200","--","/docker-entrypoint.sh"]
Image=bar