docker compose entrypoint
This commit is contained in:
parent
2a1762083b
commit
b0c1cab95a
1 changed files with 30 additions and 0 deletions
30
zk/Docker_Compose_entrypoint.md
Normal file
30
zk/Docker_Compose_entrypoint.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
tags:
|
||||
- docker
|
||||
---
|
||||
|
||||
The `entrypoint` key in a Docker compose file is useful for running any advanced
|
||||
scripts before the the main `cmd` is executed.
|
||||
|
||||
```sh
|
||||
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.
|
||||
|
||||
```sh
|
||||
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 "$@"
|
||||
```
|
||||
Loading…
Add table
Reference in a new issue