79610295

Date: 2025-05-07 10:18:15
Score: 0.5
Natty:
Report link

This article helped me a lot: https://www.docker.com/blog/docker-best-practices-choosing-between-run-cmd-and-entrypoint/

Regarding your question, you should make the "core" (unchangeable) part of your container's start command in the Dockerfile using the ENTRYPOINT instruction in exec form:

ENTRYPOINT ["executable", "arg1", "arg2"]

Then, you can provide additional command line arguments in your compose.yaml using command: field and they will be appended to your ENTRYPOINT command. To make it more flexible, you can use variables:

command:
    - $ARG3
    - $ARG4

So, starting your container using docker compose may look like:

ARG3="arg3" ARG4="arg4" docker compose up

which eventually will call executable arg1 arg2 $ARG3 $ARG4

Reasons:
  • Blacklisted phrase (1): This article
  • Blacklisted phrase (1): helped me a lot
  • Whitelisted phrase (-1.5): you can use
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: SLebedev777