# Build a Ghost Blog with Docker Compose

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

![Docker Quest - Challenge 5.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1656355445943/wic5etJ8-.png align="left")

**Pre-requisites**:

- [Docker](https://docs.docker.com/engine/install/) pre-installed

- User with `sudo` access

**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:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1656354126496/6-C9WyT3p.png align="left")

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

