Docker docs:
Docker routes container traffic in the nat table, which means that packets are diverted before it reaches the INPUT and OUTPUT chains that ufw uses. Packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration.
That’s why Docker is popular. Making sure every single system running your app has the correct versions of node and angular installed is a royal pain in the butt.