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.
More on Limits, logging, health checks and restarts
A Java container is OOM-killed at 512 MB. Why isn't the heap the whole story?IntermediateHow do you cap CPU and memory for a container and what happens on exceed?BeginnerLatency spikes though CPU usage looks low (50%).Advanced`docker logs` is empty but the app is running.BeginnerConfigure log rotation globally.BeginnerShip container logs to a central system.Intermediate