TL;DR

  • Config Docker doesn't config iptables
$
echo "{
\"iptables\": false
}" > /etc/docker/daemon.json

$ sudo systemctl restart docker
  • Or publish port locally like below
$ docker run -d -p 127.0.0.1:8080:80 nginx

src: https://www.mkubaczyk.com/2017/09/05/force-docker-not-bypass-ufw-rules-ubuntu-16-04/