4 ms·
Putting the binary in entrypoint instead of CMD seems like a misuse of what CMD was intended for, no? What if you want to run the image to do some one-off task
by timwis 6y ago
Putting the binary in entrypoint instead of CMD seems like a misuse of what CMD was intended for, no? What if you want to run the image to do some one-off task instead of the normal CMD? (e.g. override the binary)
- kortex 6y agoThen you override entrypoint. docker run --entrypoint=foo Docker compose has the key word as well.
- rualca 6y ago> Putting the binary in entrypoint instead of CMD seems like a misuse of what CMD was intended for, no? No. From Docker's official reference: > The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well. https://docs.docker.com/engine/reference/builder/#cmd https://docs.docker.com/engine/reference/builder/#cmd ENTRYPOINT should point to the entrypoint, and CMD should store default command line arguments. This allows a container image to be executed as a command line application.