Skip to content

feat: harden Docker deployment for security and reliability#16

Open
vinayaktyagi10 wants to merge 1 commit intohoneynet:mainfrom
vinayaktyagi10:feat/docker-hardening
Open

feat: harden Docker deployment for security and reliability#16
vinayaktyagi10 wants to merge 1 commit intohoneynet:mainfrom
vinayaktyagi10:feat/docker-hardening

Conversation

@vinayaktyagi10
Copy link
Copy Markdown

Summary

Hardens the Docker deployment with non-root users, healthchecks, and
proper service startup ordering.

Changes

docker/tarpits/Dockerfile & docker/prometheus/Dockerfile

  • Add non-root user (tarpit/prometheus_exporter) to both final images
  • Install wget and netcat-openbsd for healthcheck commands

docker-compose.yml

  • Add healthchecks for all services (prometheus-exporter, all pits,
    prometheus)
  • Add condition: service_healthy to depends_on for all services
  • Ensures pits only start after exporter is confirmed healthy

Why

Previously containers ran as root and had no healthchecks, meaning
a crashed exporter would still show as running while pits silently
failed to emit metrics. This change ensures correct startup ordering
and reduces attack surface by dropping root privileges.

Testing

Tested locally with docker compose up --build. All containers
reached healthy status confirmed via docker compose ps.

- Add non-root user (tarpit/prometheus_exporter) to both Dockerfiles
- Install wget and netcat-openbsd in final images for healthchecks
- Add healthchecks for all services in docker-compose.yml
- Add condition: service_healthy to depends_on for all services
- Ensures correct startup order and container health visibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant