Restrict all ports, except 443 and 80 (allow all from my ip)

Hello, I have this question.
My goal is to restrict all ports except from my ip address, ports 443 and 80 make public for all.
I found this useful link in documentation, but that blocks all ports:

Then I found more, but they didn’t work at all:

I think I’m very close, but still can’t make it work.
It either blocks everything or nothing.

Thanks for any help.

So i have been debugging, and I found some new information:

It was working, I could reach ports 80, 443 form anywhere and other ports where accessible only via my ip.
But there is another problem.
This “tweak” blocked all outgoing traffic from containers to outer world, which I need, because my containers are downloading styles and fonts from google.

I found this, which sadly didn’t help: Configuring iptables to let Docker containers access out.

Thanks for any help.