About this course
About this course
This free course teaches you Docker from the ground up - no prior experience needed. You'll learn what containers are, how to run and build your own images, how to keep data with volumes, connect containers over networks, and run whole multi-container apps with Docker Compose.
Every lesson builds on the previous one, with small, runnable examples you can try as you go. By the end you'll be able to package a real application (we'll dockerize a PHP/Laravel app) and follow the practices that keep your images small and safe.
It's written for developers who will actually run and build containers day to day, not just read about them.
Course curriculum
- What is Docker? Learn what Docker is and what a container is - and why developers use Docker to package and run applications the same way on every machine.
- Containers vs virtual machines Docker containers vs virtual machines: the key differences, and why containers are lightweight, fast, and start in seconds instead of minutes.
- Installing Docker How to install Docker: set up Docker Desktop on Windows and macOS or Docker Engine on Linux, then verify it with the docker version command.
- Your first container Run your first Docker container with docker run hello-world, and learn step by step what happens when Docker pulls an image and starts it.
- Images vs containers Docker image vs container explained with a simple analogy: an image is the read-only template, a container is a running instance of that image.
- Running containers Learn how to run Docker containers with docker run: start them in the background with -d, name them with --name, and map ports with -p.
- Listing and stopping containers Manage Docker containers from the command line: list them with docker ps, stop with docker stop, and remove with docker rm and the --rm flag.
- Managing images Manage Docker images with docker pull, docker images and docker rmi, and learn how image tags and Docker Hub versions work in practice.
- Working inside a container Open an interactive shell inside a Docker container: use docker run -it for a new container and docker exec -it bash to enter a running one.
- What is a Dockerfile? What is a Dockerfile? Learn how this plain text file of instructions (FROM, RUN, COPY, CMD) becomes the recipe Docker uses to build an image.
- Writing your first Dockerfile Write your first Dockerfile step by step using FROM, WORKDIR, COPY and CMD to package a small script into a Docker image.
- Building and running your image Build a Docker image from your Dockerfile with docker build -t, understand the build context, then run a container from your new image.
- RUN, COPY, WORKDIR and friends Learn the everyday Dockerfile instructions - RUN, COPY, ADD, WORKDIR and ENV - and exactly what each one does when Docker builds your image.
- CMD vs ENTRYPOINT CMD vs ENTRYPOINT: understand the difference, how each handles arguments, and when to use CMD, ENTRYPOINT, or both together in a Dockerfile.
- Layers and caching Learn how Docker builds images in layers, how the build cache works, and how to order Dockerfile instructions for much faster builds.
- The .dockerignore file Learn how a .dockerignore file keeps unwanted files out of your build context for smaller, faster and safer Docker images.
- Why data disappears Understand why data written inside a Docker container is ephemeral and disappears when the container is removed - and how to keep it safe.
- Volumes Learn how to create and use Docker volumes with docker volume and -v to keep data, like a database, safe even when containers are removed.
- Bind mounts Learn how Docker bind mounts link a folder on your computer into a container with -v, ideal for editing source code during local development.
- Port mapping Learn Docker port mapping: use the -p host:container flag in docker run to expose a container's port and reach the app from your browser.
- Connecting containers with networks Create a Docker network so containers reach each other by name - like a web app connecting to its database - using docker network create.
- What is Docker Compose? What is Docker Compose? Learn how it describes a multi-container app in a single docker-compose.yml file you start with one command.
- Writing a docker-compose.yml Write your first docker-compose.yml: define a service with an image and ports, then start it with docker compose up and stop it with down.
- Multi-container apps Run a multi-container app with Docker Compose: define several services in docker-compose.yml with automatic networking, volumes and env vars.
- Building images and using variables Build your own image in Docker Compose, load variables from a .env file, and control startup order with depends_on between services.
- A Dockerfile for a PHP app Write a Dockerfile for a PHP/Laravel app: pick the php:8.4 base image, install extensions, copy code and install Composer dependencies.
- Wiring the app and database with Compose Write a docker-compose.yml that builds your PHP/Laravel app image and connects it to a MySQL database, then run migrations with compose exec.
- Smaller images Reduce Docker image size with slim and alpine base images, combined-and-cleaned RUN steps, and a good .dockerignore file.
- Multi-stage builds Use Docker multi-stage builds to compile or install in one stage and ship only the result in a small final image with a second FROM.
- Security basics Simple Docker security best practices: pin image versions, keep secrets out of images, and run containers as a non-root user with USER.