Reverse proxy - restricting default docker ports

I’m not familiar with docker - can someone please explain how I can easily restrict restrict the default docker ports (which I have set to 8080 and 8443 respectively) in the OS firewall? I plan to use an apache reverse proxy to present the service via 443 as per the community post [1] but I want to ensure that this is the only service port accessible on the server.

Normally I use ufw but docker bypasses that so I’m a bit stumped!

Thanks!

[1] Guide to Setting up Bitwarden behind an Apache reverse proxy configuration