title: Connect a websocket client in a docker container to a websocket server in host
body: <p>I have a websocket server running in my host, listening to port 8080.
  In a docker container, I deployed a websocket client listening to the said server using this snippet:</p>
  
  <pre><code>connect_url="ws://0.0.0.0:80/"
  </code></pre>
  
  <p>and, exposing/mapping port 80 of the container to port 8080 of the host.</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>EXPOSE 80
  </code></pre>
  
  <p>When I ran the container:</p>
  
  <pre><code>docker run -p 8080:80 &lt;name&gt;
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <blockquote>
    <p>docker: Error response from daemon: driver failed programming external connectivity on endpoint : Error starting userland proxy: Bind for 0.0.0.0:8080 failed: port is already allocated.</p>
  </blockquote>
  
  <p>Now I think this error is because the server in the host is already using port 8080, that's why it can't be mapped.</p>
  
  <p>With these details given, I just wanted to know <strong>how can my websocket client inside the docker container connect to the websocket server in the host</strong>.</p>