Feature request: Docker swarm support (crowdsec_manager #133)

:octopus: GitHub issue crowdsec_manager #133, opened by acheslow on GitHub

Current Behavior
Currently only container names are supported for CROWDSEC_CONTAINER_NAME, TRAEFIK_CONTAINER_NAME, etc.

Docker swarm generates unique container names every time a stack is deployed; e.g. crowdsec_crowdsec.d50tqboyg9quhk8hm5316tsl3.wmf7dapml06en9gmx3y1z1439

It is possible to run crowdsec_manager on swarm by updating the *_CONTAINER_NAME variables every time the crowdsec or traefik stacks are redeployed, but this is a cumbersome manual process.

Desired Behavior
Ideally, crowdsec manager would also support swarm stacks by referencing the service names rather than the container names. The service names remain constant through redeploys; e.g. crowdsec_crowdsec, traefik_traefik, etc. These could be referenced statically in env variables like CROWDSEC_SERVICE_NAME, TRAEFIK_SERVICE_NAME, etc.

Reference


:speech_balloon: Discuss it here. Status, fixes and code review stay on GitHub.

YouveGotMeowxy commented on GitHub:

I just got bit by this as well. I spent a couple hours trying to figure out why it wasn’t seeing my ‘crowdsec’ container event though they’re in the same network and my crowdsec container’s hostname is literally ‘crowdsec’. I’m so used to containers just knowing how to do this (in a swarm) that it didn’t even cross my mind this one didnt, lol.

level=info
time=2026-08-22T03:02:53Z
msg=Database initialized
path=./data/settings.db
level=info
time=2026-08-22T03:02:53Z
msg=History database initialized
path=./data/history.db
level=info
time=2026-08-22T03:02:53Z
msg=Multi-host Docker client initialized with single default host
level=info
time=2026-08-22T03:02:53Z
msg=Checking prerequisites...
level=info
time=2026-08-22T03:02:53Z
msg= Docker daemon is running
level=fatal
time=2026-08-22T03:02:53Z
msg=Prerequisite check failed
error=required container not found: crowdsec
Container stopped