What it looks like
You removed /opt/traefik, but CrowdSec still has a volume on its logs:
volumes:
- /opt/traefik/data/logs:/opt/traefik/data/logs:ro
The next time CrowdSec is recreated, /opt/traefik/data/logs appears again, empty. CrowdSec starts and watches
logs that no longer exist.
The long syntax fails in the same situation, and the missing path shows right away:
volumes:
- type: bind
source: /opt/traefik/data/logs
target: /opt/traefik/data/logs
read_only: true
If it doesn’t work
Removed a stack, and its directory came back — empty and owned by root
- Cause
- A neighbouring stack still has a volume on the removed one’s path. The short syntax recreates the path when the container is recreated.
- Fix
- Remove that volume from the neighbour. To make a missing path visible right away, use the long syntax (
type: bind).
How to check
Before removing a stack, look for its path in the neighbours’ compose files:
grep -rn '/opt/traefik' /opt/*/docker-compose*.y*ml