Menu

1 / 5

Running a Web Server in Docker the Right Way (CodeAlpha DevOps Internship, Task 4)

DEV Community: docker·MICHAEL ABAJEMITO·3 days ago
#biKLFpSV
#devtodocker#devto#dev#nginx#docker
Reading 0:00
15s threshold

Second project from my CodeAlpha DevOps internship. The task was to deploy and manage a web server inside Docker, learn the container lifecycle, and monitor the container's health.

Getting NGINX running in Docker is one command. So I tried to set it up the way you'd want it in production: not running as root, locked down, with a proper health check, and able to recover on its own if it crashes.

Repo: github.com/mikegbenga/CodeAlpha_DockerWebServer

What I built

An NGINX container based on nginx-unprivileged , running as user 101

A /healthz endpoint that Docker checks every 15 seconds

A read-only filesystem, no Linux capabilities, and CPU and memory limits

manage.sh , a script for the whole container lifecycle, with tests and a crash test

Optional monitoring with the NGINX Prometheus exporter and Prometheus

GitHub Actions that lint, build, run, test and scan the image on every push

This is the page it serves.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.