title: Docker exposed network port does not reach container service
body: <p>I am building and starting it:</p>
  
  <pre><code>sudo docker build  -t docker_mads_dask_server ~/docker_setups/dask_cluster
  
  echo "Stop/Remove dask_server"
  sudo docker stop dask_server -t5
  sudo docker rm dask_server
  
  echo "Build tag"
  sudo docker build --tag mads_servers.dask_server:0.1.2 ~/docker_setups/dask_cluster
  sudo docker run --publish 0.0.0.0:8710:8710 --publish 0.0.0.0:8711:8711 --detach --name dask_server mads_servers.dask_server:0.1.2
  </code></pre>
  
  <p>And I can actually see how it runs:</p>
  
  <pre><code>$ sudo docker ps
  
  CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS              PORTS                                        NAMES
  a29f89f6929f        mads_servers.dask_server:0.1.2   "python3 /code/mads/…"   4 minutes ago       Up 4 minutes        0.0.0.0:8710-8711-&gt;8710-8711/tcp, 8787/tcp   dask_server
  </code></pre>
  
  <p>Now I connect into the container:</p>
  
  <pre><code>$ sudo docker exec -it dask_server /bin/bash
  root@a29f89f6929f
  </code></pre>
  
  <p>And see if the connection is open:</p>
  
  <pre><code># (inside container)
  $ curl -vvv http://127.0.0.1:8710
  [...]
  &lt; HTTP/1.1 404 Not Found
  &lt; Server: TornadoServer/6.0.4
  </code></pre>
  
  <p>So the webserver is actually up and reachable <strong>within</strong> the container. 
  Now lets check it from the outside:</p>
  
  <pre><code># (outside container)
  $ sudo netstat -tulpn | grep 87
  
  tcp6       0      0 :::8710                 :::*                    LISTEN      8705/docker-proxy   
  tcp6       0      0 :::8711                 :::*                    LISTEN      8692/docker-proxy  
  </code></pre>
  
  <p>Ports are open, a bit scared about tcp6 - So I changed it to explicit IP matches:</p>
  
  <pre><code>--publish 192.168.56.11:8710:8710 --publish 192.168.56.11:8711:8711
  </code></pre>
  
  <p>and the netstat now shows IPv4:</p>
  
  <pre><code># (outside container)
  tcp        0      0 192.168.56.11:8710      0.0.0.0:*               LISTEN      13039/docker-proxy  
  tcp        0      0 192.168.56.11:8711      0.0.0.0:*               LISTEN      13025/docker-proxy  
  </code></pre>
  
  <p>but the same connection test gets:</p>
  
  <pre><code>$ curl -vvv http://127.0.0.1:8710
  * Rebuilt URL to: http://127.0.0.1:8710/
  *   Trying 127.0.0.1...
  * TCP_NODELAY set
  * Connected to 127.0.0.1 (127.0.0.1) port 8710 (#0)
  &gt; GET / HTTP/1.1
  &gt; Host: 127.0.0.1:8710
  &gt; User-Agent: curl/7.58.0
  &gt; Accept: */*
  &gt; 
  * Recv failure: Connection reset by peer
  * stopped the pause stream!
  * Closing connection 0
  curl: (56) Recv failure: Connection reset by peer
  </code></pre>
  
  <p>My <code>Dockerfile</code>:</p>
  
  <pre><code>FROM ubuntu:20.04
  FROM python:3.8
  
  RUN apt update &amp;&amp; apt install -y cowsay tmux vim net-tools iotop
  RUN python -m pip install pandas numpy dask distributed redis sqlalchemy tornado cloudpickle
  RUN python -m pip install dask[dataframe] --upgrade
  ADD code/ /code/
  
  # Dashboard port
  EXPOSE 8710
  
  # Scheduler port
  EXPOSE 8711
  EXPOSE 8787
  
  CMD ["python3", "/code/mads/mads_pkg/mads_servers/dask_server.py"]
  </code></pre>
  
  <p><strong>So why is the <code>dask-proxy</code> not forwarding it to the containers exposed port?</strong></p>