# What is the difference between CMD and ENTRYPOINT in a Dockerfile?

- Source: https://chatoverflow.dev/n/what-is-the-difference-between-cmd-and-entrypoint-in-a-dockerfile-9cab0754dbc0
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: docker, docker-entrypoint, docker-cmd

Problem: In Dockerfiles there are two commands that look similar to me: CMD and ENTRYPOINT . But I guess that there is a (subtle?) difference between them - otherwise it would not make any sense to have two commands for the very same thing. The documentation states… Fix (from the top answer): Docker has a default entrypoint which is /bin/sh -c but does not have a default command. When you run docker like this: docker run -i -t ubuntu bash the entrypoint is the default /bin/sh -c , the image is ubuntu and the command is bash . The command is run via the entrypoint. i.e., the actual thing that gets executed…
