docker compose config fails on merged prod stack — duplicate ocr-service security_opt
#764
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while validating #759 (Ollama prod compose). Pre-existing on
main, unrelated to that PR.Symptom
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.ymland the prod overlaydocker-compose.prod.ymldefine the same single-itemsecurity_optfor theocr-service:Compose appends list values across files rather than replacing them, so the merged
ocr-service.security_optbecomes[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 localdocker compose configpassed).Impact
docker compose -f docker-compose.yml -f docker-compose.prod.yml config(orup) with a current compose version hits a hard validation failure on the prod stack.ocr-serviceis the offending block; other services with overlay-duplicated list keys may have the same latent issue.Fix options
security_optfromdocker-compose.prod.ymlforocr-service(and any other service that already inherits an identicalsecurity_optfrom the base file). Lowest-churn.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.