Docker · 12-day planAll days
Day 7 of 12 35 minDockerfilebuildCMD
Package your own apps as images. Write a two-line Dockerfile for a static website, then a full one for a Python web app. Learn the core instructions (FROM, WORKDIR, COPY, RUN, EXPOSE, CMD), what the build context is, and how to read build errors.
By the end of today you can
- Write a Dockerfile and build it with docker build -t
- Use FROM, WORKDIR, COPY, RUN, EXPOSE and CMD
- Tell the difference between RUN (at build time) and CMD (when a container starts)
- Explain the build context (the . in docker build .)
- Read a build error and fix it, including the 127.0.0.1 trap
What's inside
- 4 sections
- 2 diagrams and mind maps
- 5 code examples you can run
- 5-question quiz
- 1A website in two lines
- 2A Python web app
- 3The 127.0.0.1 trap
- 4Reading build errors
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free