724 B
724 B
| tags | |
|---|---|
|
The entrypoint key in a Docker compose file is useful for running any advanced
scripts before the the main cmd is executed.
app:
image: python:3.11-slim
entrypoint: ["./entrypoint.sh"]
command: ["python", "src/app.py"]
I used it recently to inject a .pem certificate into the container before the
main execution.
The script must conclude with exec "$@" because it receives the value of the
command key in the Compose file as its argument. E.g.
cat /etc/ssl/certs/ca-certificates.crt /zscaler.pem > /tmp/combined-certs.pem
export REQUESTS_CA_BUNDLE=/tmp/combined-certs.pem
export SSL_CERT_FILE=/tmp/combined-certs.pem
pip install -r requirements.txt
exec "$@"