I'm considering installing Docker, but I came across a statement saying that if I publish a port through Docker, it's exposed regardless of my firewall rules. I'm a bit worried because I haven't forwarded any ports on my router. Does it mean that publishing a port could expose my network to the internet? Or is this simply a precaution about how Docker interacts with the firewall on my device, not affecting my router? I want to use Docker, but I definitely don't want to compromise my network's security.
3 Answers
Docker controls the firewall on the host machine where it's running, but it doesn't touch firewall settings on other devices, like your router. So as long as you haven't opened any ports on your router, you're good! Totally safe to run your containers without exposing your network.
As long as you don’t open ports on your router, everything within your Docker containers stays safe and private. Docker does influence your host's firewall, but it's important to be aware of that so you can manage it accordingly. I have multiple containers running, and I've exposed only a couple to the outside world through a reverse proxy.
When Docker runs on a Linux machine, you can use UFW (Uncomplicated Firewall) to limit which ports are open to the outside world. Just make sure any ports you do expose on your router are secure. Docker will set its own rules, so you'll need to manage those wisely to avoid unintentional exposure.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux