Docker Community Forums

Share and learn in the Docker community.

Unable to connect to container

I am running an nginx container

#-> docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                      NAMES
6694daef5704        nginx:1.17          "nginx -g 'daemon of…"   3 hours ago         Up 3 hours          0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx

within the container I am able to do

root@6694daef5704:/# nc -zv 127.0.0.1 443
localhost [127.0.0.1] 443 (?) open

also

root@6694daef5704:/# ss  -tpln
State  Recv-Q Send-Q Local Address:Port  Peer Address:Port
LISTEN 0      128          0.0.0.0:80         0.0.0.0:*    users:(("nginx",pid=1,fd=6))
LISTEN 0      128       127.0.0.11:37681      0.0.0.0:*
LISTEN 0      128          0.0.0.0:443        0.0.0.0:*    users:(("nginx",pid=1,fd=7))

This is what ss is giving me on the host

#-> ss -tpln
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port
LISTEN      0      100     127.0.0.1:25                          *:*                   users:(("master",pid=1536,fd=13))
LISTEN      0      128     127.0.0.1:199                         *:*                   users:(("snmpd",pid=1289,fd=8))
LISTEN      0      10      127.0.0.1:29131                       *:*                   users:(("mdsd",pid=9698,fd=18))
LISTEN      0      128             *:22                          *:*                   users:(("sshd",pid=1290,fd=3))
LISTEN      0      128          [::]:443                      [::]:*                   users:(("docker-proxy",pid=25613,fd=4))
LISTEN      0      128          [::]:3306                     [::]:*                   users:(("docker-proxy",pid=24041,fd=4))
LISTEN      0      128          [::]:80                       [::]:*                   users:(("docker-proxy",pid=25625,fd=4))
LISTEN      0      5            [::]:4118                     [::]:*                   users:(("ds_agent",pid=1404,fd=10))

so everything looks great but when I run nc on the host

#-> nc 127.0.0.1 443

is giving me a timeout.

when I try to make requests in browser they all time out. How can I fix this?