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
Discuss it here. Status, fixes and code review stay 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.