Orchestrating Services: Using Docker Compose to Launch a Personal Website
If Docker is the tool that lets you build a single container, Docker Compose is the conductor that manages a whole orchestra. Most modern websites aren't just one program; they are a team. You might have a web server (like Nginx), a database (like MariaDB), and a content manager (like WordPress).
Instead of starting three separate containers manually, Docker Compose lets you define your entire "stack" in a single text file.
1. The Power of the YAML File
The heart of Docker Compose is the docker-compose.yml file. This file uses YAML (a human-readable format) to describe exactly how your services should talk to each other.
Why use Compose?
- One-Command Setup: Type
docker compose up -dand your whole site goes live. - Portability: Move that one text file to a new Ubuntu server, and your site will look identical.
- Networking: It automatically creates a "private" network so your database can talk to your website safely.
2. Creating a "Personal Blog" Stack
Letβs use Docker Compose to launch a Ghost blogβone of the fastest, most professional open-source blogging platforms in 2026.
Step 1: Create a Project Folder
It is best practice to give every "stack" its own directory.
mkdir my-blog && cd my-blog
Step 2: Create the Compose File
Open a new file: nano docker-compose.yml. Paste the following:
version: '3.8'
services:
ghost:
image: ghost:5-alpine
restart: always
ports:
- "8080:2368"
environment:
# In 2026, always use https if you have a domain!
url: http://localhost:8080
volumes:
- ./content:/var/lib/ghost/content
3. Launching the Stack
Once your file is saved, run the "magic" command:
docker compose up -d
up: Build and start the containers.-d: Detached mode. This runs the site in the background so you can keep using your terminal.
Test it: Open your browser and go to http://localhost:8080. You should see your brand-new professional blog ready for setup!
4. Understanding "Volumes" (Data Persistence)
In the code above, youβll notice the line - ./content:/var/lib/ghost/content. This is a Volume.
In Docker, if a container is deleted, all the data inside it vanishes. A volume acts like a "bridge" between a folder on your Ubuntu system and a folder inside the container. This ensures that even if you update the software, your blog posts and images stay safe in your local my-blog/content folder.
5. Essential Compose Commands
Once your stack is running, youβll need these four commands to manage it:
| Command | Action |
|---|---|
docker compose ps |
Shows if your website services are currently healthy. |
docker compose logs -f |
Shows "live" error logs (great for troubleshooting). |
docker compose stop |
Pauses your website without deleting any data. |
docker compose down |
Stops the containers and removes the virtual network. |
6. Going Public: Reverse Proxies
In 2026, most Ubuntu users don't just leave their site at localhost:8080. To show your site to the world, you typically add a "Reverse Proxy" like Nginx Proxy Manager or Traefik to your Compose file. These tools automatically handle SSL certificates (HTTPS) so your site has the little green padlock in the browser bar.
Pro Tip: Formatting Matters!
YAML is very picky about spaces. Never use the "Tab" key in a docker-compose.yml file; always use two spaces for indentation, or the file will fail to run.