Docker Essentials

This is a free book and course showing you the essentials of how to develop and deploy applications with Docker. You'll learn how to develop, test, and debug your applications, debug containers when they don't work properly, and deploy your code to production (or anywhere else).
Please correct the following error(s):
  • {{ error }}

I'll email you with regular updates to the book and course so that you know how it's progressing and when it goes live. You can unsubscribe at any time. Here's the privacy policy.

Why Get This Book and Course?

Modern, web-based applications play a central role in modern life. They let us do almost all of our essential tasks online, whether that's communicating with friends and family to shopping and banking.

However building and deploying them can be a challenge for two key reasons:
  1. Working with other developers; and
  2. Deploying applications to remote environments without encountering bugs because of differences between the development and remote environment
This course will teach you the essentials of how to develop and deploy applications (using PHP examples) with Docker. You'll learn how to develop, test, and debug their applications, debug containers when they don't work properly, and deploy your code to productionor anywhere else.

What You'll Learn

Learn the Essential Terminology

Before you dive into creating a local development environment using Docker, you'll learn some essential terminology that you need to be aware of, such as Image and Container.

Learn How to Install Docker

Now that you know some of the key terminology, it's time to install Docker and the related tools that you'll need to follow along with the book. In this chapter, you'll learn how to do that on the three major operating systems: Linux, macOS, and Microsoft Windows.

Learn How to Build a Local Development Environment

In this chapter, you're going to get your hands dirty with Docker by learning how to build a development environment which mirrors production (or any other environment). You're going to learn the essentials of Dockerfiles and Docker Compose files (docker-compose.yml) to build a 3-service configuration that can run an application on your local development machine. On top of that, you're going to learn the essential Docker commands for starting and stopping containers and testing that they're running properly.

Learn How to Debug a Docker Container

Now that you've learned how to create a basic setup with Docker Compose, you're going to learn how to do basic container debugging. If things go wrong, you need to know how to figure out what’s going wrong and why. With that knowledge, you can either fix the problem or ask someone for help if you’re unable to fix it on your own. So in this chapter, you're going to learn the docker commands to debug containers.

Learn How to Run Tests and Debug Apps Running Inside Docker Containers

Docker and Docker Compose make it pretty trivial to build local development environments. But what about running tests and debugging applications running inside containers, versus on your local development machine? How do you run unit, functional, acceptance, and other types of tests when the code and runtime are inside Docker containers, not on your local machine? How do you do step-through debugging?

In this chapter, I'll show you how to augment the configuration which we've built so far, to do both. Specifically, I'll show you how to run tests using PHPUnit and Codeception and to do step-through debugging using PhpStorm.

Learn How to Deploy an Application

In the final chapter of the book, you'll learn how to build Dockerfiles and Docker Compose files to deploy applications to a remote environment. You'll also learn some of the things that you need to consider when deploying containers to remote environments, versus on your local development machine, as well as learn about building, tagging, and pushing Docker Images to image registries, and how to create Docker Contexts so that you can work with multiple remote Docker daemons.

Who's the Author?

Hi, I'm Matthew Setter. I've been developing web-based applications since 1996 and developing with PHP since version 3 — way back in 1999 before it even had OOP support. I've been involved in building all kinds of PHP-based applications in Australia, the United Kingdom, and Germany. I'm also a PHP editor in the Twilio Voices team.

I regularly share what I know and am continuing to learn about PHP and web development more broadly on my site: Web Dev with Matt. I was the co-host of The Undercover elePHPant, a podcast about scaling and optimizing PHP applications. I'm also the author of Mezzio Essentials, Zend Framework 2 Foundations, Mezzio: Getting Started, Zend Db Deep Dive, and Zend Framework 2: The Basics.

Photo of Matthew Setter (@settermjd), author of Mezzio Essentials