Build a Ghost Blog with Docker Compose

A Cloud Enthusiast
In this blog, we will create a Ghost Blog using Docker Compose.

Pre-requisites:
Docker pre-installed
User with
sudoaccess
Steps:
Create a Docker Compose file docker-compose.yml in the root directory. You will create two services: a Ghost Blog service and a MySQL service. Below is the code:
version: "3"
services:
ghost:
container_name: ghost-blog
image: ghost:1-alpine
restart: always
environment:
- database__client=mysql
- database__connection__host=mysql
- database__connection__user=root
- database__connection__password=P4sSw0rd0!
- database__connection__database=ghost
ports:
- 80:2368
volumes:
- ghost-volume:/var/lib/ghost
depends_on:
- mysql
mysql:
container_name: ghost-db
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=P4sSw0rd0!
volumes:
- mysql-volume:/var/lib/mysql
volumes:
ghost-volume: {}
mysql-volume: {}
Run docker-compose up -d to deploy the defined services.
Once completed, you can run docker ps to list the deployed containers as below:

You can then access the ghost blog from your web browser using your public IP address!


