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.
What is Docker Compose?
Compose is a file format for describing distributed Docker apps, and it’s a tool for managing them.
What is Ghost?
Let’s go! 🐳
Step 1 — Login to the server and become root
1. SSH into the server and become root
sudo su -
Step 2 — Create a Ghost Blog and MySQL service
2. Create a
docker-compose.yml file in the root directory
Add the following contents
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:
Step 3 — Start up the Docker compose service and Bring up the Ghost Blog
docker-compose up -d
Congrats your blog is up and running! Validate via the public IP address of your Docker server.
Connect with me on Twitter @toutfinesse
Top comments (5)
Great post @chauntelkellar I love how its short and simple to follow!
I just want to add:
Step 4 — View Docker compose logs
docker-compose logs -fto stop viewing the logs
Step 5 — Stop specific Docker service
docker-compose stop ghost-blog
Step 6 — Stop all Docker compose services
Thanks @danbamikiya ! I agree with your additions.
Thanks @chauntelkellar ! Have a great day!
Great. I have an extension for your post. Please see - dev.to/vishalraj82/using-https-in-...