docker compose config fails on merged prod stack — duplicate ocr-service security_opt #764

Open
opened 2026-06-06 20:20:36 +02:00 by marcel · 0 comments
Owner

Found while validating #759 (Ollama prod compose). Pre-existing on main, unrelated to that PR.

Symptom

$ IMPORT_HOST_DIR=/tmp/x docker compose -f docker-compose.yml -f docker-compose.prod.yml config
validating .../docker-compose.prod.yml: services.ocr-service.security_opt items at 0 and 1 are equal
# exit 1

The merged prod config fails to validate. The dev file alone (-f docker-compose.yml config) validates fine (exit 0).

Root cause

Both the base docker-compose.yml and the prod overlay docker-compose.prod.yml define the same single-item security_opt for the ocr-service:

security_opt:
  - no-new-privileges:true

Compose appends list values across files rather than replacing them, so the merged ocr-service.security_opt becomes [no-new-privileges:true, no-new-privileges:true]. A recent Docker Compose version now rejects identical list items as a validation error (older versions silently deduped/accepted, which is why the PR #759 author's local docker compose config passed).

Impact

  • Anyone running docker compose -f docker-compose.yml -f docker-compose.prod.yml config (or up) with a current compose version hits a hard validation failure on the prod stack.
  • It is not Ollama-specific — ocr-service is the offending block; other services with overlay-duplicated list keys may have the same latent issue.

Fix options

  1. Remove the redundant security_opt from docker-compose.prod.yml for ocr-service (and any other service that already inherits an identical security_opt from the base file). Lowest-churn.
  2. Audit all services for list keys duplicated between base and overlay (security_opt, cap_drop, tmpfs, …) and remove the redundant overlay entries.

Notes

This is exactly the class of breakage the proposed CI compose-lint step (Sara/Felix on #759) would catch on every PR — worth pairing this fix with filing that CI step.

Found while validating #759 (Ollama prod compose). Pre-existing on `main`, unrelated to that PR. ## Symptom ``` $ IMPORT_HOST_DIR=/tmp/x docker compose -f docker-compose.yml -f docker-compose.prod.yml config validating .../docker-compose.prod.yml: services.ocr-service.security_opt items at 0 and 1 are equal # exit 1 ``` The **merged** prod config fails to validate. The dev file alone (`-f docker-compose.yml config`) validates fine (exit 0). ## Root cause Both the base `docker-compose.yml` and the prod overlay `docker-compose.prod.yml` define the same single-item `security_opt` for the `ocr-service`: ```yaml security_opt: - no-new-privileges:true ``` Compose **appends** list values across files rather than replacing them, so the merged `ocr-service.security_opt` becomes `[no-new-privileges:true, no-new-privileges:true]`. A recent Docker Compose version now rejects identical list items as a validation error (older versions silently deduped/accepted, which is why the PR #759 author's local `docker compose config` passed). ## Impact - Anyone running `docker compose -f docker-compose.yml -f docker-compose.prod.yml config` (or `up`) with a current compose version hits a hard validation failure on the prod stack. - It is **not** Ollama-specific — `ocr-service` is the offending block; other services with overlay-duplicated list keys may have the same latent issue. ## Fix options 1. **Remove the redundant `security_opt` from `docker-compose.prod.yml`** for `ocr-service` (and any other service that already inherits an identical `security_opt` from the base file). Lowest-churn. 2. Audit all services for list keys duplicated between base and overlay (`security_opt`, `cap_drop`, `tmpfs`, …) and remove the redundant overlay entries. ## Notes This is exactly the class of breakage the proposed **CI compose-lint** step (Sara/Felix on #759) would catch on every PR — worth pairing this fix with filing that CI step.
marcel added the P1-highbugdevops labels 2026-06-06 20:20:45 +02:00
Sign in to join this conversation.
No Label P1-high bug devops
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#764