Docker: ENTRYPOINT vs CMD



examples/curl-runner/Dockerfile
FROM ubuntu:23.04
RUN apt-get update
RUN apt-get install -y curl

ENTRYPOINT ["curl"]   # fixed part
CMD ["--silent", "https://httpbin.org/get"]  # replacable part
By default if you run a container based on this image, Docker will execute a command which is a combination of the ENTRYPOING + CMD.

However, on the command-line where you call docker run, you can provide a replacement for the CMD part.


$ docker build -t mydocker .


$ docker run --rm  mydocker


$ docker run --rm  mydocker https://szabgab.com/