arrow_back
Back

Dockerfile CMD: default container command

Andrew Dorokhov Andrew Dorokhov schedule 1 min read

CMD specifies the default command to run inside the container. Only one CMD instruction is effective — the last one wins (including CMD in parent images).

If ENTRYPOINT is defined, CMD provides default arguments to the entrypoint (use exec form in that case).

Arguments passed to docker run after the image name override CMD. The command runs at container initialization.

code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Dockerfile ARG: build-time variables

arrow_forward