Skip to content
Theory · Dockerfile, layers and the cache · lesson 6 of 8

CMD and ENTRYPOINT

The last line of the shop API's Dockerfile is CMD ["python", "app.py"]. It does nothing at build time: it records in the image what to run when a container starts from it. This line has two forms of writing and a neighboring instruction, ENTRYPOINT. The choice decides which process becomes the main one in the container and whether a request to stop ever reaches the app.

In this lesson

  • CMD is the default command
  • ENTRYPOINT and CMD together
  • Two forms of writing
  • Common mistake
  • Key points