Overview

1 Before you begin

Docker packages applications into lightweight, portable containers that run consistently across laptops, data centers, and clouds. The technology is widely adopted and valued for its simplicity and impact, and this book takes a practical, hands-on path that gets complete beginners running containers quickly. This opening chapter sets the stage by explaining why containers matter, how they solve real problems, and what learning approach the book uses so readers can judge if it matches their goals.

Real-world use cases center on five themes. For cloud migration, containers provide a third path beyond IaaS and PaaS, combining portability with efficient, standardized operations, usually without changing application code—just packaging with Dockerfiles and application manifests. Legacy systems can be modernized incrementally by first containerizing a monolith and then carving out features into separate services that communicate over private container networks, gaining faster releases, independent scaling, and technology flexibility. New cloud‑native apps embrace microservices where each component runs in its own container and can be built, tested, and composed uniformly, with third‑party services easily pulled in from container registries. Containers also underpin emerging models like serverless and support domains such as machine learning and IoT, enabling one platform to run diverse workloads. Finally, Docker accelerates DevOps by unifying tools and processes across development and operations, aligning well with CALMS principles to boost automation, flow, measurement, and sharing.

The book is for readers who want to apply Docker to real problems, emphasizing practical usage over internals, with cross‑platform samples that work on Windows, macOS, and Linux (including Arm). Kubernetes appears later as the common way to run containers in production, building on the same skills learned here. To follow along, set up a local lab by installing Docker (Desktop or alternatives), verify Docker and Compose are working, obtain the sample source code, and use simple cleanup commands as you progress so your environment stays tidy.

The original options for migrating to the cloud—use IaaS and run lots of inefficient VMs with high monthly costs, or use PaaS and get lower running costs but spend more time on the migration.
The same app, migrated to Docker before moving to the cloud. This application has the cost benefits of PaaS with the portability benefits of IaaS and the ease of use you get only with Docker.
Decomposing a monolith into a distributed application without rewriting the whole project. All the components run in Docker containers, and a routing component decides whether requests are fulfilled by the monolith or a new microservice.
Cloud-native applications are built with microservice architectures where every component runs in a container.
A single cluster of servers running Docker can run every type of application, and you build, deploy, and manage them all in the same way no matter what architecture or technology stack they use.

Being immediately effective

“Immediately effective” is another principle of the Month of Lunches series. In all the chapters that follow, the focus is on learning skills and putting them into practice.

Every chapter starts with a short introduction to the topic, followed by try-it-now exercises where you put the ideas into practice using Docker. Then there’s a recap with some more detail that fills in some of the questions you may have from diving in. Lastly, there’s a hands-on lab for you to go to the next stage.

All the topics center around tasks that are genuinely useful in the real world. You’ll learn how to be immediately effective with the topic during the chapter, and you’ll finish by understanding how to apply the new skill. Let’s start running some containers!

FAQ

What is Docker, and why do containers matter?Docker is a platform that runs applications in lightweight, isolated units called containers. Containers give you a consistent, portable runtime across laptops, data centers, and clouds, which simplifies delivery and operations and has driven widespread adoption across the industry.
How hands-on is this book, and when will I run my first containers?It’s beginner-friendly and practical. You’ll be running containers in chapter 2 and packaging applications by chapter 3. Most chapters include labs that work the same on Windows, macOS, and Linux.
What kinds of problems can containers help me solve?Five big ones: migrating apps to the cloud, modernizing legacy monoliths, building new cloud‑native microservices, exploring innovations like serverless/ML/IoT, and enabling DevOps transformations with shared tooling and processes.
How do containers improve cloud migration compared to IaaS or PaaS?Containers give you the portability of IaaS with cost and operational efficiency close to PaaS—without heavy rewrites. You package each component into a container and run consistently on any platform (AKS, ECS, your own cluster, or even a laptop) using the same Docker-based workflow.
Can I modernize a monolith incrementally with Docker?Yes. Start by containerizing the monolith, then peel off features into separate services running in their own containers. Container networking and a routing layer let you transition gradually, gaining faster releases, independent scaling, and technology flexibility without a full rewrite.
How does Docker accelerate cloud‑native microservices development?Each service has its own Dockerfile and runs in its own container. A single Docker Compose file can define and run the whole app locally. You can build code inside containers (no local toolchains required) and add third‑party components from Docker Hub and CNCF projects with minimal setup.
Where does serverless fit, and can I avoid cloud lock‑in?Under the hood, cloud serverless platforms package and run functions in containers. Cloud functions aren’t portable across providers, but you can run serverless on your own Docker cluster with open source frameworks like Nuclio, Knative, or OpenFaaS—alongside monoliths and microservices.
How does Docker support DevOps and the CALMS framework?Docker unifies dev and ops around shared artifacts and commands (Dockerfiles, Compose), enabling automation, lean delivery, clear metrics, and easy sharing (via Docker Hub). That shared toolchain helps teams move from siloed, infrequent releases to frequent, low‑risk deployments.
What do I need to install, and how do I verify my setup?- Install Docker Desktop for Windows, macOS, or Linux (free for learning). Alternatives include installing the Docker Engine directly or using apps like Rancher Desktop or Colima. - Verify Docker: run “docker version” and ensure both Client and Server show versions. - Verify Compose: run “docker compose version” and check you see a version number without errors.
Where do I get the sample code, and how do I clean up after exercises?- Code: “git clone https://github.com/sixeyed/diamol.git”, then “cd diamol” and “git checkout 2e”. Or download the ZIP from the GitHub branch page. - Cleanup containers: “docker container rm -f $(docker container ls -aq)” - Cleanup images from the book: “docker image rm -f $(docker image ls -f reference='diamol/**' -q)” Docker will re‑download anything you remove when you need it again.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Learn Docker in a Month of Lunches, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Learn Docker in a Month of Lunches, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Learn Docker in a Month of Lunches, Second Edition ebook for free