Book Image

Beginning DevOps with Docker

By : Joseph Muli
5 (1)
Book Image

Beginning DevOps with Docker

5 (1)
By: Joseph Muli

Overview of this book

Making sure that your application runs across different systems as intended is quickly becoming a standard development requirement. With Docker, you can ensure that what you build will behave the way you expect it to, regardless of where it's deployed. By guiding you through Docker from start to finish (from installation, to the Docker Registry, all the way through to working with Docker Swarms), we’ll equip you with the skills you need to migrate your workflow to Docker with complete confidence.
Table of Contents (7 chapters)

The docker-compose Tool


Let's begin the lesson by looking at what a multi-container setup is, why it is important, and how Docker, with the tool docker-compose, works like a charm in such scenarios.

We have recently been introduced to how applications work, with their separate elements: frontend, backend, and database.

To run such a multi-tier application using Docker, one would need to run the following commands to spin up the containers in different terminal sessions:

- docker run <front-end>
- docker run <back-end>
- docker run <database>

Note

You can run docker run with (-d) as detached to prevent us from running the three commands in separate sessions, for example: docker run <front-end> -d

That said, it even becomes particularly tasking linking different containers (networking).

docker-compose comes in to save the day. We can define and run multi-containers from one file - docker-compose.yml. In the following topics, we'll discuss this further. First, let's install...