Resources · Troubleshooting · Q&A · port 6379
Why can the internet reach Redis when UFW denies 6379?
Docker published ports are accepted in the FORWARD chain before UFW’s INPUT policy runs.
Check command
docker ps --format '{{.Names}} {{.Ports}}'
Copied.
Docker inserts its own iptables rules. A container published as 0.0.0.0:6379 is reachable from the internet even when UFW says deny. UFW manages the INPUT chain. Docker DNATs the port and then accepts it in FORWARD.
Confirm it
ss -tulpn | grep 6379
docker ps --format '{{.Names}} {{.Ports}}'
sudo ufw status verbose
If the port is 0.0.0.0:6379 and UFW has no ALLOW for 6379, the firewall is not the control you think it is.
Fix
Publish Redis on loopback only:
services:
redis:
ports:
- "127.0.0.1:6379:6379"
Then recreate the container. From a second machine, the port should stop answering.