Interview Prep/Docker/Limits, logging, health checks and restarts

Set ulimits for a database container that needs many file descriptors.

IntermediateScenarioLimits, logging, health checks and restarts
Answer

Situation read → Default nofile may be too low (or very high in newer systemd setups causing slowdowns).

What I'd do →

docker run --ulimit nofile=65536:65536 --ulimit memlock=-1:-1 db

In Compose, ulimits: key. Verify with docker exec db sh -c 'ulimit -n'.

Why → Limits are per-process rlimits set at container start.

Interview tip → Elasticsearch needs vm.max_map_count set on the host, not in the container.

All Docker questions Roadmap: Docker & containers

More on Limits, logging, health checks and restarts