Chapter 2. Discovering Docker
Chapter 1 from Docker in Practice by Ian Miell and Aidan Hobson Sayers.
This chapter covers
- What Docker is
- The uses of Docker and how it can save you time and money
- The differences between containers and images
- Docker’s layering feature
- Building and running a to-do application using Docker
Docker is a platform that allows you to “build, ship, and run any app, anywhere.” It has come a long way in an incredibly short time and is now considered a standard way of solving one of the costliest aspects of software: deployment.
Before Docker came along, the development pipeline typically involved combinations of various technologies for managing the movement of software, such as virtual machines, configuration management tools, package management systems, and complex webs of library dependencies. All these tools needed to be managed and maintained by specialist engineers, and most had their own unique ways of being configured.
Docker has changed all of this, allowing different engineers involved in this process to effectively speak one language, making working together a breeze. Everything goes through a common pipeline to a single output that can be used on any target—there’s no need to continue maintaining a bewildering array of tool configurations, as shown in figure 1.1.
Before we get our hands dirty, we’ll discuss Docker a little so that you understand its context, where the name “Docker” came from, and why we’re using it at all!
We’re going to get our hands dirty now by building a simple to-do application (todoapp) image with Docker. In the process, you’ll see some key Docker features like Docker-files, image re-use, port exposure, and build automation. Here’s what you’ll learn in the next 10 minutes:
The details of the application are unimportant. We’re going to demonstrate that from the single short Dockerfile we’re about to give you, you can reliably build, run, stop, and start an application in the same way on both your host and ours without needing to worry about application installations or dependencies. This is a key part of what Docker offers—reliably reproduced and easily managed and shared development environments. This means no more complex or ambiguous installation instructions to follow and potentially get lost in.