🐳 Day 44: Write a Docker Compose File | 100 Days of DevOps
Welcome to Day 44 of the 100 Days of DevOps series! In this lab, you’ll deploy an Apache (httpd) container using Docker Compose and configure port + volume mapping.
📌 Lab Objective:
Create a Docker Compose setup to run an httpd container serving static content.
🛠️ Task Requirements:
Server: App Server 3
File Path: /opt/docker/docker-compose.yml
Image: httpd latest
Container Name: httpd
Port Mapping: 8083 → 80
Volume Mapping: /opt/dba → /usr/local/apache2/htdocs
💻 Step-by-Step Solution:
🔹 1. Create directory
mkdir -p /opt/docker
🔹 2. Create docker-compose file
vi /opt/docker/docker-compose.yml
🔹 3. Add below content
version: '3'
services:
web:
image: httpd:latest
container_name: httpd
ports:
"8083:80"
volumes:
/opt/dba:/usr/local/apache2/htdocs
🔹 4. Start container
docker-compose -f /opt/docker/docker-compose.yml up -d
🔍 Verify
docker ps
🌐 Test
curl http://localhost:8083
👉 You should see the website content from /opt/dba
📚 What You’ll Learn:
Writing Docker Compose files
Port mapping concepts
Volume mounting
Running multi-container setups
🌟 Why This Lab Matters:
Docker Compose simplifies container deployment and is widely used in real-world DevOps workflows.
🎯 Series: 100 Days of DevOps
Level up your real-world DevOps skills step by step.
🔔 Follow OtterTech for more hands-on labs and practical learning!
#Docker #DockerCompose #DevOps #Apache #Containers #Linux #100DaysOfDevOps #OtterTech #Day44