- Lab
- A Cloud Guru
Build Services with Docker Compose
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.
Path Info
Table of Contents
-
Challenge
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:
-
-
Challenge
Bring Up the Ghost Blog Service
- Start up the Docker Compose service.
docker-compose up -d
- Start up the Docker Compose service.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.