Topic 6 of 12

Containers with Docker

Understand what a container really is, then build, run, connect and ship one with Docker, from a single image to a small multi-service app.

After this topic you can: You can explain what a container is, write a Dockerfile, run and debug containers, keep their data, connect them, and describe a small app in a Compose file.

8 lessons · 83 min · 0 of 8 done

Best read after: Linux and the shell, Networking for DevOps

Draft. This lesson is written and waiting for a person to run every command and review it. It is safe to learn from, but check the official documentation for anything you depend on.

Lessons, in order

  1. 1What a container actually isCoreSee that a container is an ordinary Linux process with its own view of the system and a resource limit, and how that differs from a virtual machine.8 min
  2. 2Images, layers and tagsCoreLearn how an image packages files into read-only layers, how tags and digests name them, and why a running container's changes do not stay.8 min
  3. 3Running and inspecting containersCoreRun containers with docker run, publish ports, pass environment variables, read logs, open a shell inside, and follow the container lifecycle.10 min
  4. 4Writing a DockerfileCoreBuild your own image from a Dockerfile, understand the build context and layer cache, and know when CMD or ENTRYPOINT is the right choice.12 min
  5. 5Volumes and bind mountsCoreKeep data beyond a container's life with named volumes, share a host folder with a bind mount, and fix the permission denied errors that follow.10 min
  6. 6Container networkingCoreUnderstand bridge networks, published ports and name-based DNS between containers, and why localhost does not reach another container.11 min
  7. 7Docker Compose for multi-service appsCoreDescribe several containers, their network and volumes in one compose.yaml, start them with one command, and handle startup order correctly.12 min
  8. 8Small and safe imagesAdvancedShrink and harden your images with multi-stage builds, a non-root user and a .dockerignore, and avoid the build mistakes that follow.12 min

Keep these open while you learn

Next topic

CI/CD pipelinesLearn how a pipeline turns every commit into a tested, packaged and deployable change, using GitHub Actions to see each moving part.

Search

Search cheat sheets and projects