Big Data

Docker from Scratch: Containers, Images and Docker Compose

A free, 100% hands-on course: run containers, build your own images with a Dockerfile, keep data in volumes, connect services on networks and start complete applications with Docker Compose in 20 labs.

Beginner · 20 hours · 20 lessons · Free course · Course language: Spanish and English

Learn Docker from scratch with 20 guided labs. You start with your first container and learn its life cycle: create, stop, start, inspect and delete. Then you build your own images with a Dockerfile, understand layers and the cache, and shrink them with multi-stage builds. You publish web servers with ports, keep data with volumes and bind mounts, and connect containers on networks where they find each other by name. With Docker Compose you start a Python application with Redis from a single file: volumes, healthchecks, variables, profiles and scaling. You finish with security best practices (non-root user, read-only mode, memory and CPU limits), debugging, image registries and a final project with nginx, a Python API and PostgreSQL. Every command is explained and every result is real: all the labs were run with Docker Engine 29 and Docker Compose v5. The lessons, quizzes and videos are in English; the lab files keep their original Spanish names, and every lesson explains them.

What you will learn

  • Run, stop, inspect and delete containers with confidence
  • Build your own images with a Dockerfile, take advantage of the cache and use multi-stage builds
  • Publish ports and keep data with volumes and bind mounts
  • Connect containers on networks where they find each other by name
  • Describe multi-service applications with Docker Compose
  • Apply best practices: non-root user, read-only mode, limits and healthchecks
  • Publish images to a registry and deploy a complete application with nginx, Python and PostgreSQL

Skills

Docker, Containers, Dockerfile, Images, Volumes, Docker networks, Docker Compose, Container security, Image registries

Program

Module 1: Containers

What Docker is, your first container, its life cycle and how to look inside.

Project: An nginx server you inspect from the inside: logs, processes, files and resources.

  1. What Docker is and your first container: Images, containers, Docker Desktop and your first docker run commands.
  2. The life cycle of a container: Create, list, stop, start and delete containers; interactive mode and --rm.
  3. Looking inside: logs, exec, inspect and stats: Read the logs, run commands inside, inspect the configuration and measure resources.

Module 2: Images and Dockerfile

Images, tags and layers; Dockerfile, the cache and multi-stage builds.

Project: Three images of your own: a Python program, a command-line tool and a website.

  1. Images, tags and layers: docker pull, tags, layers, docker image inspect and deleting images.
  2. Your first image with a Dockerfile: FROM, WORKDIR, COPY and CMD; docker build and docker run of your own image.
  3. Dockerfile in depth: RUN, ENV, ARG, ENTRYPOINT and CMD: Installing dependencies, environment and build variables, and the startup command.
  4. Layer cache and multi-stage builds: Order the Dockerfile to build fast, .dockerignore and small images.

Module 3: Ports and data

Publishing ports, volumes, bind mounts and tmpfs.

Project: A website published in your browser and a Redis database that keeps its data.

  1. Publishing ports: a web server: Map ports with -p, see your site in the browser and solve ports already in use.
  2. Volumes: data that survives: Why data is lost, named volumes and a persistent Redis database.
  3. Bind mounts and tmpfs: Share folders from your computer, read-only mode, --mount and temporary memory.

Module 4: Networks

User-defined networks, DNS between containers and a two-service app.

Project: A Python visit counter that stores its data in Redis.

  1. Networks: containers that talk: User-defined networks, DNS by name and connecting existing containers.
  2. A two-container application: A Python visit counter with Redis, environment variables and --env-file.

Module 5: Docker Compose

compose.yaml, volumes, healthchecks, variables, profiles and scaling.

Project: The visit counter described in a single file and scaled to three replicas.

  1. Docker Compose: your first compose.yaml: Services, build, ports and depends_on; up, ps, logs and down.
  2. Compose: volumes, healthchecks and depends_on: Persistent data, healthy services and restart policies.
  3. Compose: variables, .env and profiles: Variable interpolation, the .env file, docker compose config and profiles.
  4. Compose day to day: rebuild, exec and scale: Change code and rebuild, run commands and scale a service.

Module 6: Best practices and final project

Security, debugging, image registries and a complete application.

Project: A course catalog with nginx, a Python API and PostgreSQL in Docker Compose.

  1. Security: non-root user, read-only mode and limits: USER, --read-only, memory and CPU limits, capabilities and digests.
  2. Restarts, healthchecks and debugging: Exit codes, restart policies, healthchecks and docker events.
  3. Registries: publish and download your images: A local registry, docker push and pull, and how to publish to Docker Hub.
  4. Final project: a complete web application with Compose: nginx, a Python API and PostgreSQL with secrets, healthchecks and volumes.

Prerequisites

  • A Windows, macOS or Linux computer with 8 GB of RAM
  • Docker Desktop installed (we show you how in the first lab)
  • Basic use of the terminal. You don't need to know how to program: the examples' code is already written and explained

Next courses

  • Intermediate Docker: Real Production Cases · Intermediate · 20 hours
    Build fast, small and secure images, organize Compose for teams, run networks, data and logs the way production does, and automate with CI/CD. 20 labs with real cases, based on the official documentation.
  • Neo4j and Graph Databases with Docker · Beginner · 20 hours · Free course
    A free, 100% hands-on course: run Neo4j with Docker, master Cypher, import real data, connect from Python and analyze graphs with APOC and Graph Data Science in 20 labs.

See all courses