Hosted static website with Docker Compose on Day 44 of #100DaysOfDevOps

🚀 Day 44 of #100DaysOfDevOps Today’s task was to host a static website using a containerized platform with Docker Compose. The Nautilus DevOps team provided the requirements, and I set up the environment accordingly. ✅ Requirements: Use httpd:latest image Container must be named httpd Map host port 6100 → container port 80 Map host volume /opt/devops → /usr/local/apache2/htdocs 🔹 Step 1: Create the compose directory & file mkdir -p /opt/docker cd /opt/docker vi docker-compose.yml 🔹 Step 2: Add the compose configuration version: "3.9" services: webserver: image: httpd:latest container_name: httpd ports: - "6100:80" volumes: - /opt/devops:/usr/local/apache2/htdocs 🔹 Step 3: Deploy with Docker Compose docker compose -f /opt/docker/docker-compose.yml up -d\ 🔹 Step 4: Verify & test docker ps | grep httpd curl -I http://localhost:6100/\ ✅ Static website content from /opt/devops is now being served via Apache on http://localhost:6100 💡 Key takeaway: Docker Compose makes it straightforward to declare container setup in YAML, making the environment reproducible and portable — crucial for team collaboration and future deployments. #100DaysOfDevOps #Docker #DockerCompose #Containers #DevOps #Automation #Linux

if the docker compose yaml is in the same directory you can simply run docker compose build & docker compose up -d instead of -f

To view or add a comment, sign in

Explore content categories