skip to content
Alvin Lucillo

Docker container cmd args

/ 1 min read

Suppose you have this Dockerfile with image ubuntu-sleeper built using it:

FROM ubuntu
ENTRYPOINT ["sleep"]
CMD ["5"]
  • To just run sleep 5, run docker run --name sleeper ubuntu-sleeper . This takes in the default entrypoint/base command sleep and appends the default command arg 5
  • To override the default command to run sleep 6, run docker run --name sleeper ubuntu-sleeper 6.
  • To override the default entrypoint and command to run sleep2.0 10, run docker run --name sleeper --entrypoint sleep2.0 ubuntu-sleeper 10