# CMD vs. ENTRYPOINT

> Explain the difference between CMD and ENTRYPOINT in a Dockerfile. How do they interact, and how does each behave when you pass arguments to docker run?

Canonical: https://www.internhack.in/learn/interview/docker-containers/docker-cmd-vs-entrypoint
Last updated: 2026-11-28

Difficulty: Intermediate

## Question

Explain the difference between CMD and ENTRYPOINT in a Dockerfile. How do they interact, and how does each behave when you pass arguments to docker run?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

CMD, ENTRYPOINT, Exec Form, --entrypoint flag, Entrypoint Scripts

Previous: [Images vs. Containers](https://www.internhack.in/learn/interview/docker-containers/docker-images-vs-containers) · Next: [Multi-stage Builds](https://www.internhack.in/learn/interview/docker-containers/docker-multi-stage-builds) · [All of Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)

## More Docker & Containers questions

- [Volumes vs. Bind Mounts](https://www.internhack.in/learn/interview/docker-containers/docker-volumes-vs-bind-mounts)
- [COPY vs. ADD](https://www.internhack.in/learn/interview/docker-containers/docker-copy-vs-add)
- [Docker Compose](https://www.internhack.in/learn/interview/docker-containers/docker-compose-purpose)
- [Networking Drivers](https://www.internhack.in/learn/interview/docker-containers/docker-networking-drivers)
- [Graceful Shutdown (Stop vs Kill)](https://www.internhack.in/learn/interview/docker-containers/docker-container-killing-graceful)
- [Dockerizing Node.js Apps](https://www.internhack.in/learn/interview/docker-containers/dockerize-node-app-best-practices)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Docker & Containers](https://www.internhack.in/learn/interview/docker-containers)
