Learnr

Learn Docker

Package any app so it runs the same on every machine.

or browse all courses.

Free to start. Built from a single prompt. No credit card.

Docker is a platform for building and running containers: lightweight, isolated environments that bundle an application with its dependencies. Unlike a virtual machine, a container shares the host kernel, so it starts in seconds and uses little overhead. You describe how to build an image in a Dockerfile, run containers from that image, and share images through registries like Docker Hub. Docker Compose lets you start a whole stack, such as a web app plus a database, with one command. Learnr builds you a personalized Docker course from one prompt with short, interactive lessons that end in a containerized app.

How to learn Docker, step by step

  1. Install Docker and run your first container. Install Docker Desktop or Docker Engine on Linux, then run docker run hello-world and docker run -it ubuntu bash. Use docker ps, docker logs and docker stop to see what is running.
  2. Understand images versus containers. An image is a read-only template built from layers; a container is a running instance of it. Pull an image, start two containers from it and notice that changes in one do not affect the other.
  3. Write a Dockerfile for your own app. Containerize a small Python or Node.js app using FROM, WORKDIR, COPY, RUN and CMD. Copy dependency files and install them before copying source code, so rebuilds reuse cached layers.
  4. Handle data, ports and environment. Publish ports with -p 8080:80, pass configuration with environment variables, and use named volumes for databases. Learn that data written inside a container without a volume disappears when it is removed.
  5. Compose a multi-container stack. Write a compose.yaml with your app and a database like PostgreSQL, start it with docker compose up, and connect services by name on the default network.
  6. Slim down images and share them. Use smaller base images, a .dockerignore file and multi-stage builds, then push an image to a registry. Keep Docker commands fresh with quick Learnr lessons while you containerize more projects.

What you'll learn

  • Explain images, containers, layers and registries
  • Run, inspect, stop and clean up containers from the CLI
  • Write efficient Dockerfiles with good layer caching
  • Persist data with volumes and connect containers on networks
  • Run a multi-container app with Docker Compose

What's inside your Docker course

A sample path Learnr builds for Docker. Your real course adapts to your goal and level.

  • 1. Containers versus virtual machines
  • 2. Running and managing containers
  • 3. Building images with Dockerfiles
  • 4. Volumes, bind mounts and data
  • 5. Networking and ports
  • 6. Docker Compose and multi-container apps

How long does it take to learn Docker?

Running containers and writing a basic Dockerfile take about 1 to 2 weeks at a few hours a week. Comfort with volumes, networking, Compose and image optimization usually takes 1 to 2 months. Linux and networking knowledge make it much faster.

What you need before you start

Basic command-line skills and some experience building or running an application. A little Linux and networking knowledge, such as ports and environment variables, helps a lot.

Common mistakes to avoid

  • Storing database data inside a container without a volume, then losing it on removal. Mount a named volume for anything that must persist.
  • Copying the whole project before installing dependencies, which breaks layer caching and makes every build slow. Copy dependency manifests first.
  • Baking secrets like passwords into images. Pass them at runtime through environment variables or a secrets mechanism, and keep them out of the Dockerfile.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn Docker, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full Docker course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

Docker questions, answered

What is the difference between Docker and a virtual machine?

A virtual machine runs a full guest operating system on virtual hardware. A container shares the host kernel and isolates only the application and its dependencies, so it is lighter and starts faster.

Should I learn Docker before Kubernetes?

Yes. Kubernetes orchestrates containers, so you need to understand images, containers, ports and volumes first. Docker skills are the foundation Kubernetes builds on.

Is Docker free to use?

Docker Engine is open source. Docker Desktop is free for personal use and education, with paid plans required for some larger businesses, so check the current terms for work use.

Explore more courses

More programming and tech courses

See all programming and tech courses

Ready to learn Docker?

Start your free, personalized Docker course in seconds. .