Deepomatic / dmake

DMake is a tool to manage micro-service based applications
MIT License
36 stars 3 forks source link

Add DMAKE_DOCKER_RUN_EXTRA_ARGS env var support #562

Closed thomas-riccardi closed 8 months ago

thomas-riccardi commented 8 months ago

Sometimes it's useful to add more arguments to the docker run command.

Fo example: DMAKE_DOCKER_RUN_EXTRA_ARGS=--add-host=host.docker.internal:host-gateway so the containers can talk to a service exposed on the host. (use docker network inspect bridge | jq -r .[].IPAM.Config[].Gateway to get the docker IP on host side to not expose to your whole LAN)

Implementation details: Since bash array vars cannot be passed via env vars, we limit our support (no space inside arguments), and rely on the bash word split on spaces with no variable quoting. volontarily non-escaped env var to allow passing mutiple extra args via one env var (bash array vars cannot be passed via env vars); limitations: split on spaces will break any tentative of space escaping: space chars are not supported.

how to pass multiple arguments: DMAKE_DOCKER_RUN_EXTRA_ARGS='--arg1=1 --arg2=2'

sonarcloud[bot] commented 8 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

thomas-riccardi commented 8 months ago

Maybe add one line in readme ?

advanced usage via env vars is not documented here; I don't plan to start now