Docker Compose automatically detects and deep-mergesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/infra-neo/CICD/llms.txt
Use this file to discover all available pages before exploring further.
docker-compose.override.yml with the base docker-compose.yml at startup — no flags required. This mechanism lets you layer production-specific settings on top of the base configuration without touching the base file, making it easy to keep upstream changes without merge conflicts. The repository ships a fully annotated template at docker-compose.override.yml.example that covers every hardening option described on this page.
Setup
Copy the example file to activate it:docker-compose.override.yml in your editor and uncomment or adjust the sections you need. The file is gitignored by default, so local customisations stay off version control.
Pinning Image Versions
The basedocker-compose.yml uses floating tags (lts, community, latest). For production, pin each image to a specific digest or version tag to prevent unintended upgrades during docker compose pull.
docker compose pull followed by docker compose up -d to replace running containers with the pinned images.
JVM Heap Tuning
The default JVM settings indocker-compose.yml are sized conservatively for development laptops. For production hosts with more memory, increase heap allocations through environment variable overrides.
Jenkins — append heap flags to JAVA_OPTS:
INSTALL4J_ADD_VM_PARAMS value:
The sum of all container heap allocations must fit within the host’s available
RAM. A fully tuned stack with the values above requires approximately 12 GB of
JVM heap alone, in addition to kernel, Docker daemon, and OS overhead. Adjust
values to match your host capacity.
Resource Limits
Docker Composedeploy.resources blocks cap the CPU and memory each container can consume. This prevents a single runaway service from starving the others.
limits define the hard ceiling Docker enforces; the container is OOM-killed if it exceeds the memory limit. reservations are a soft guarantee — Docker will attempt to schedule the container on a node that has at least this much available.
Health Checks
Health checks let Docker track service readiness and automatically restart containers that stop responding. Without astart_period, Docker begins counting retries immediately, which causes false positives during the slow initial startup of JVM-based services.
Jenkins — polls the root HTTP endpoint with curl:
wget:
docker compose ps shows a (healthy) or (unhealthy) status alongside each container, and depends_on conditions can reference service_healthy to order startup correctly.
PostgreSQL Tuning
Pass PostgreSQL server parameters directly via thecommand block in the override. This avoids the need for a custom postgresql.conf file:
max_connections=300 ensures SonarQube’s connection pool has enough headroom under load. shared_buffers=256MB allocates a larger portion of RAM for PostgreSQL’s internal page cache, reducing disk I/O for repeated queries.
Bind-Mount Volumes for Production Data Persistence
The basedocker-compose.yml uses anonymous named volumes managed entirely by Docker. For production, bind-mount the volumes to explicit host paths so that data survives Docker engine upgrades, host reboots, and accidental docker volume prune runs.
docker-compose.override.yml is listed in .gitignore by default. This
means you can safely store production-specific values — including passwords
referenced via ${DB_PASSWORD} — in the override file without risk of
accidentally committing them. For team environments, consider managing the
override file through a secrets manager or a separate private repository.