Spent days wondering why fail2ban kept banning IPs that kept hammering my Docker-published WordPress login. The bans were inserted, fail2ban-client status said “banned” - but the traffic never stopped.
The reason: on a Docker host, fail2ban’s default action drops rules into the INPUT chain. Packets to published ports are processed by Docker’s FORWARD/DOCKER-USER chain before INPUT ever sees them. So the ban is real, it just drops nothing.
The fix is one token: point the jail action at the DOCKER-USER chain instead of INPUT.
Second gotcha in the same jail: it reads Caddy’s JSON access log, whose timestamp is a fractional epoch mid-line, so I needed a custom datepattern or fail2ban parsed zero lines.
The verify step that would’ve caught this in five minutes: after a ban, run iptables -L DOCKER-USER -n and actually see the IP there - never trust “fail2ban is running.”
Full walk-through with the JSON-log filter regex will be in the follow up post.
The trick is to run caddy on the host system no containment, then reverse proxy your wordpress containers through 8080+. Letting fail2ban and crowdsec interact with caddy through docker is too much hassle.
“The fix is one token”… Sure, because everything is a token now? Are you well?


