Previous Lecture Complete and continue  

  Why Use Docker?

Now that we've ran a Docker container and explored some of the components behind Docker, it'll be easier to visualize why developers want to use a tool like Docker. Some of the big benefits are:

  • Consistency between environments
  • Increased developer productivity
  • Deployment simplicity and automation

Consistency between environments

When developing applications, we ideally want our environments to be consistent across the board. After all, nobody likes it when an application works perfectly on one developer's machine, but then fails on a teammate's machine. Or even worse, fails in production.

A lot of the time though, environments aren't consistent, and getting a development environment set up takes time and potentially money. Docker helps provide that consistency through replicable containers. We'll continously see that Docker containers are created from images, which define how a container should be instantiated and run. As long as we're using the same image, we can create as many containers as we want on different machines, all with a consistent environment.

Increased developer productivity

While consistency can result in fewer headaches amongst developers, Docker provides other tools that help increase developer productivity.

Image Registry

We'll learn that we need images that instruct Docker on how to run a container. However, it would be very time-consuming if we had to build our own images for every type of application. Luckily, Docker provides a registry called Docker Hub. Docker Hub provides many public, free images for developers to use. There are images for a variety of applications and tools, like MySQL, Node, Nginx, Python, and Ruby. This makes it really easy to get started quickly. We'll also learn about creating our own images to share with others on Docker Hub.

Multiple Container Management

Most web applications will involve more than one container. An application may consist of multiple servers, databases, and other services. Each one will require its own Docker container, which can be a struggle to get set up.

Docker provides a tool called Docker Compose that makes it easy to define and run applications that need multiple containers. After defining containers in Docker Compose, the entire application can be started using one command instead of several.


Overall, Docker has great documentation for developers, along with guides and references to help you setup everything.

Deployment simplicity and automation

All of the benefits above tie nicely into application deployment. Because Docker containers are replicable, consistent, and self-contained, deployment can often be plugged into an automated pipeline. We'll talk more about this when deploying a Docker container.

TL;DR: Docker can save developers a lot of time and effort thanks to consistent, replicable, and isolated containers. Docker also provides benefits like robust tooling and an active community of developers.