Docker Compose Assignment
DevOps Easy Learning
Objective
This assignment is designed to assess your understanding of Docker Compose, containerized applications,
and your ability to deploy a web application using Docker.
Part 1 - Docker Compose Analysis
Study the Docker Compose configuration below.
services:
api:
build: .
container_name: api
ports:
- "8080:8080"
environment:
DB_HOST: postgres
REDIS_HOST: redis
depends_on:
- postgres
- redis
networks:
- app-network
postgres:
image: postgres:16
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
redis:
image: redis:7
networks:
- app-network
volumes:
postgres-data:
networks:
app-network:
Task
Explain the Docker Compose file line by line.
Your explanation should demonstrate that you understand the configuration rather than simply describing it.
Part 2 - Deploy a Website Using Docker Compose
Using the project available in the GitHub repository below:
[Link]
1. Clone the repository.
2. Review the project structure.
3. Create an appropriate Dockerfile for the application if one is not already provided.
4. Create a [Link] file.
5. Build the Docker image.
6. Start the application using Docker Compose.
7. Verify that the website is accessible in a web browser.
8. Ensure the application can be stopped and restarted using Docker Compose commands.