A Developer’s Essential Guide to Docker Compose
local graph
A Developer’s Essential Guide to Docker Compose
Section titled “A Developer’s Essential Guide to Docker Compose”chapter_01
Section titled “chapter_01”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-01-introduction-to-docker-compose — Introduction to Docker Compose
chapter_02
Section titled “chapter_02”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-02-running-the-first-application-using-compose — Running the First Application Using Compose
chapter_03
Section titled “chapter_03”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-03-network-and-volumes-fundamentals — Network and Volumes Fundamentals
chapter_04
Section titled “chapter_04”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-04-executing-docker-compose-commands — Executing Docker Compose Commands
chapter_05
Section titled “chapter_05”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-05-connecting-microservices — Connecting Microservices
chapter_06
Section titled “chapter_06”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-06-monitoring-services-with-prometheus — Monitoring Services with Prometheus
chapter_07
Section titled “chapter_07”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-07-combining-compose-files — Combining Compose Files
chapter_08
Section titled “chapter_08”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-08-simulating-production-locally — Simulating Production Locally
chapter_09
Section titled “chapter_09”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-09-creating-advanced-ci-cd-tasks — Creating Advanced CI/CD Tasks
chapter_10
Section titled “chapter_10”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-10-deploying-docker-compose-using-remote-hosts — Deploying Docker Compose Using Remote Hosts
chapter_11
Section titled “chapter_11”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-11-deploying-docker-compose-to-aws — Deploying Docker Compose to AWS
chapter_12
Section titled “chapter_12”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-12-deploying-docker-compose-to-azure — Deploying Docker Compose to Azure
chapter_13
Section titled “chapter_13”node-book_a-developer-s-essential-guide-to-docker-compose_chapter-13-migrating-to-kubernetes-configuration-using-compose — Migrating to Kubernetes Configuration Using Compose
Preface
Section titled “Preface”The book explains the fundamentals of Docker Compose and its usage. You will discover the usage of Docker components under Compose along with Compose commands, their purpose, and their use cases. Further on, you will explore setting up databases for daily usage, leveraging Docker networking, and establishing communication between microservices. You will also run entire stacks locally on Compose, simulate production environments, and enhance CI/CD jobs using Docker Compose. Finally, you will learn about advanced topics such as Docker Compose on production deployments, provisioning infrastructure on public clouds such as AWS and Azure, and also pave the way for a migration to the Kubernetes orchestration engine.
Who this book is for
Section titled “Who this book is for”This book is for software engineers, developer advocates, and DevOps engineers looking to set up multi-container Docker applications using Compose without the need to set up a Docker orchestration engine and the expertise required. It is also for team leads looking to increase the productivity of an organization’s software teams by streamlining the provisioning of complex development environments locally using Docker Compose.
What this book covers
Section titled “What this book covers”Chapter 1, Introduction to Docker Compose, provides an overview of how Compose works and its various usages. There will be a brief explanation of the Docker Compose file format and a Compose example will be run.
Chapter 2, Running the First Application Using Compose, shows you how to create a simple Golang application that interacts with a Redis database. At the end of the chapter, you will have managed to run a multi-container application through Compose.
Chapter 3, Network and Volumes Fundamentals, dives into the fundamentals of Docker volumes and networks. At the end of the chapter, you will have defined and used a network for the existing application.
Chapter 4, Executing Docker Compose Commands, takes you through the Compose commands, their purpose, and the use cases.
Chapter 5, Connecting Microservices, explores creating new microservices. At the end of the chapter, you should have developed new microservices within the same network and established connectivity between them.
Chapter 6, Monitoring Services with Prometheus, covers adding monitoring to the services backed by the monitoring solution Prometheus.
Chapter 7, Combining Compose Files, looks at modularizing the Compose file and splitting it into multiple parts.
Chapter 8, Simulating Production Locally, provides an overview of complex Compose configurations with the goal of simulating production partially or fully in a local environment.
Chapter 9, Creating Advanced CI/CD Tasks, shows you how to create more advanced CI/CD tasks by simulating cases using Compose.
Chapter 10, Deploying Docker Compose Using Remote Hosts, covers deploying to remote hosts using Compose.
Chapter 11, Deploying Docker Compose to AWS, covers utilizing the knowledge acquired on Compose to achieve a deployment on AWS using ECS.
Chapter 12, Deploying Docker Compose to Azure, focuses on another popular cloud provider, Azure. At the end of the chapter, you should achieve a deployment on Azure ACI.
Chapter 13, Migrating to Kubernetes Configuration Using Compose, shows you how to translate the Compose files to a Kubernetes Deployment.
To get the most out of this book
Section titled “To get the most out of this book”You are expected to understand containerization and must possess fundamental Docker knowledge. Also, you should be comfortable with shell scripting. Ideally, a UNIX workstation would be the best option to progress through the book. Most of the code and commands presented should also be able to run on Windows machines.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
Conventions used
Section titled “Conventions used”There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Mount the created nginx.conf configuration file as another file in your system.”
A block of code is set as follows:
type Task struct {Id string \`json:"id"\`Name string \`json:"name"\`Description string \`json:"description"\`Timestamp int64 \`json:"timestamp"\`}When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
services: redis: image: redis ports: - 6379:6379Any command-line input or output is written as follows:
$ curl --location --request POST 'localhost:8080/task/'$ cat /etc/nginx/nginx.confBold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the Administration panel.”
Tips or Important Notes
Appear like this.
Source: