For the last six months, the Acme Anvil Corporation has been migrating some of their bare metal infrastructure to Docker containers. Your team wants to find an easier way to deploy applications that consist of multiple containers and has decided to use Docker Compose. You have been tasked with setting up an internal blog so the team can write technical articles. This blog will consist of two services: a Ghost Blog service and a MySQL service. Both services will use volumes for persistent storage.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create a Ghost Blog and MySQL Service
Create a
docker-compose.yml
file in the root directory.vi docker-compose.yml
Add the following contents to it:
version: '3' services: ghost: image: ghost:1-alpine container_name: ghost-blog restart: always ports: - 80:2368 environment: database__client: mysql database__connection__host: mysql database__connection__user: root database__connection__password: P4sSw0rd0! database__connection__database: ghost volumes: - ghost-volume:/var/lib/ghost depends_on: - mysql mysql: image: mysql:5.7 container_name: ghost-db restart: always environment: MYSQL_ROOT_PASSWORD: P4sSw0rd0! volumes: - mysql-volume:/var/lib/mysql volumes: ghost-volume: mysql-volume:
- Bring Up the Ghost Blog Service
- Start up the Docker Compose service.
docker-compose up -d
- Start up the Docker Compose service.