Run Multi-container apps with Docker Compose

Containerization of apps is a fast-growing practice as many companies are embracing the cloud and DevOps concepts. Docker packages an application, libraries, and its dependencies in a virtual container that can run on any server. Being that most applications do not run on one single component (even dinosaur apps 🦖 have frontend and backend components), we need a way to define and manage multi-container apps.

In this tutorial I will utilize Docker compose to get a blog up and running that consists of a Ghost Blog service and a MYSQL service; both services will use volumes for persistent storage. This tutorial assumes you have working knowledge of Docker and a server with Docker and Docker compose installed.

docker compose services
docker compose services
docker compose services

Compose is a file format for describing distributed Docker apps, and it’s a tool for managing them.

Ghost is a free and open source blogging platform written in Javascript.

Step 1 — Login to the server and become root

1. SSH into the server and become root

ssh <username>@PUBLIC\_IP\_ADDRESS

sudo su -

Step 2 — Create a Ghost Blog and MySQL service

2. Create a docker-compose.yml file in the root directory

vi docker-compose.yml

Add the following contents

Step 3 — Start up the Docker compose service and Bring up the Ghost Blog

3. docker-compose up -d

Congrats your blog is up and running! Validate via the public IP address of your Docker server.

ghost blog
ghost blog
ghost blog

Connect with me on Twitter @toutfinesse

Hi! I'm Chauntel a self-taught Cloud Native DevOps Engineer transitioning from a career in pharmacy. When I'm not in cloud, I also love traveling & working out.