podman-compose
podman-compose copied to clipboard
podman-compose handles entrypoint different from docker-compose
See also: https://github.com/containers/libpod/issues/4595
With the following docker-compose.yaml
:
services:
certbot:
image: docker.io/certbot/dns-cloudflare
container_name: certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
podman-compose
will raise errors like this:
Error: container_linux.go:346: starting container process caused "exec: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait 17813{!}; done;'": stat /bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait 17813{!}; done;': no such file or directory": OCI runtime command not found error
This works in docker-compose
.
I think I found a similar one from one of the certbot/nginx guides, the syntax of the wait part causes issues
certbot:
image: certbot/certbot
restart: unless-stopped
volumes:
- /mnt/certbot/conf:/etc/letsencrypt
- /mnt/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
Seems related to #129
Use the devel branch and merge pull request 98 yourself. Than this is fixed.
I think you mean #97 but the question is more "why these PR are not already merged ?"
#97 might fix the $$ escape issue but it seems like it is still treating 'entrypoint' as a literal command and so it doesn't work whereas it does work with docker-compose.
pwd $ pwd ~/podman-compose
$ git log commit 2d80e435dd05f0307c865673a527197b668c4c8e (HEAD -> devel, origin/devel, origin/HEAD) Author: Muayyad alsadi [email protected] Date: Thu Oct 14 02:12:28 2021 +0300
remove print
$ git branch
- devel
when trying to ../podman-compose/podman-compose.py up -d
Error: executable file /bin/sh -c "sleep 1h; trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait ${!}; done;"
not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
offending line in docker-compose.yml
entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;"
also tried: entrypoint: '/bin/sh -c "sleep 1h; trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;"'
in the yaml file.
Even just something like '/sbin/sh -c "certbot renew --webroot -w /var/www/certbot;" doesn't work because it is trying to run the literal entire string as if it were a binary.
#97 claims it is already merged in this version. What do?
Even really simplifying the entrypoint:
Error: executable file /bin/sh -c 'certbot renew --webroot -w /var/www/certbot'
not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
is not treating it properly...
I'm getting the same issue as @wendelltron . Just to simplify the error further:
version: "3"
services:
foo:
image: docker.io/alpine:latest
entrypoint: /bin/sh -c
podman-compose up
results in Error: unable to start container abc123: executable file '/bin/sh -c' not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
@andrew-womeldorf please test.
NOTE: it's preferred to use list for command and entrypoint not strings. the compose specs refer to dockerfile which says: Quote: The exec form, which is the preferred form:
version: "3"
services:
foo:
image: docker.io/alpine:latest
entrypoint: ["/bin/sh", "-c"]
command: ["ls /bin"]
anyway, I think it's fixed now.
entrypoint is fixed in .yaml(so that certbot compose now works), but when specifying entrypoint in podman-compose run --entrypoint "sh -c "
it is still broken, ie https://github.com/signalapp/Signal-TLS-Proxy/blob/ac94d6b869f942ec05d7ef76840287a1d1f487f9/init-certificate.sh#L35
another unrelated issue is that docker-compose run
does not respect selecting a single container (service) to run, runs all containers instead