Why can't I connect to any container from outside localhost?

I have Docker server setup on a Ubuntu headless server on my home network. Docker works great. I have collabora running and now portainer. Collabora runs through an Apache proxy under Owncloud. Portainer exposes port 9443 to all networks (0.0.0.0:9443). But if I try to connect to Portainer from my Windows PC on the same network, it fails. If I ssh to the server from Windows and tunnel port 9443 from my Windows localhost, it connects to Portainer.

The firewall on the server exposes port 9443. And if I run nmap localhost -p 9443 on the server I can see its open and listening. If I run netstat I get:

netstat -lntp | grep 9443
tcp 0 0 0.0.0.0:9443 0.0.0.0:* LISTEN 719748/docker-proxy
tcp6 0 0 :::9443 :::* LISTEN 719754/docker-proxy

Looks good to me, yet no machine outside localhost can access any container on the server.

HELP!

What does that mean? “Could not connect”, “404 not found”, any other error message?

Thank you for your reply!!

From a web browser to “https://172.20.21.2:9443” - the connection times out.
If I telnet to that same ip and port from my Windows PC, the connection times out also.
Otherwise - all native applications on the server are accessible from my lan, https, imap, ssh, etc.

Got it! - specifically for a container that is started with the docker run command line, I needed to add the option
“–network host” as part of the start string. So the whole string that used to look like this:

docker run -d -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.0

Now looks like this instead:

docker run -d --network host --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.0

And this connects it to my local network instead of just to the local machine running docker.