CodeAlpha DevOps Internship — Task 4: Web Server using Docker
A reproducible, production-style web server packaged in a Docker container. A static site is served by nginx from a small Alpine-based image, with a built-in container health check, one-command orchestration via Docker Compose, and a monitoring guide.
- Docker containerization fundamentals (image, layers, build context)
- Writing a clean, pinned Dockerfile
- The full container lifecycle: build → run → inspect → stop → remove
- Health monitoring with
HEALTHCHECKand a dedicated/healthzendpoint - One-command orchestration with Docker Compose
- Troubleshooting and resource monitoring (
docker stats,docker logs,docker inspect)
Browser ──HTTP:8080──▶ Docker host ──:80──▶ [ nginx container ]
├─ /usr/share/nginx/html (static site)
└─ HEALTHCHECK → GET /healthz
CodeAlpha_DockerWebServer/
├── Dockerfile # builds the nginx image
├── docker-compose.yml # one-command run with healthcheck + restart policy
├── .dockerignore # keeps the build context small
├── nginx/
│ └── default.conf # nginx server config + /healthz endpoint
├── site/
│ ├── index.html # the served web page
│ └── styles.css
└── docs/
├── monitoring.md # health, logs, stats, troubleshooting
└── screenshots/ # demo screenshots
Prerequisite: Docker installed and running.
docker compose up -d --build
# open http://localhost:8080
docker compose down # when finisheddocker build -t codealpha-webserver .
docker run -d --name codealpha-webserver -p 8080:80 codealpha-webserver
# open http://localhost:8080
docker stop codealpha-webserver && docker rm codealpha-webserver# Health verdict: healthy / unhealthy
docker inspect --format '{{.State.Health.Status}}' codealpha-webserver
# Live resource usage
docker stats codealpha-webserver
# Health endpoint
curl http://localhost:8080/healthz # -> okSee docs/monitoring.md for the full monitoring & troubleshooting guide.
Docker · Docker Compose · nginx (Alpine) · HTML/CSS
Ali — CodeAlpha DevOps Internship, 2026