Beginner

Dockerfile Fundamentals

Write a correct, efficient Dockerfile from scratch and build/run a real image — covering FROM, RUN, COPY, WORKDIR, ENV, EXPOSE, CMD vs ENTRYPOINT, and HEALTHCHECK.

~3h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Docker Engine installed and running (verify with docker --version); basic command-line comfort; a small app (Node.js or Python "hello world" works) to containerize.

Targeted versions: Docker Engine 29.x / Dockerfile syntax=docker/dockerfile:1 (verified against docs.docker.com, mid-2026).

In this project you'll take a plain script or small app and turn it into a portable container image using nothing but a text file called a Dockerfile. By the end you'll understand what each instruction actually does at build time versus run time, why instruction order affects build speed, and how to run the image you produce as a container with a published port.

Dockerfiles are read top to bottom. Docker runs each instruction in order and caches the result of each one as a layer, which is why the order you write instructions in has a real, measurable effect on how fast repeat builds are.

🔨

Your first Dockerfile

🔨

Layer caching and .dockerignore

🔨

EXPOSE, CMD vs ENTRYPOINT

🔨

Add a HEALTHCHECK

🎯
Secret Mission

Secret Mission: containerize something of your own

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock