title: ngrok in docker cannot connect to Django development server
body: <p>I am working on a localhost django webserver <code>http://localhost:8000</code>, which works fine.
  Meanwhile i need ngrok to do the port forwarding, <code>ngrok http 8000</code>, which works fine too.</p>
  
  <p>Then I want to put ngrok, postgres, redis, maildev, etc all in docker containers, all others works fine, except ngrok.  </p>
  
  <p>ngrok failed to contain to localhost:8000. </p>
  
  <p>I understand why, i suppose because ngrok is running on a seperate 'server 'and the localhost on that server does not have web server running.</p>
  
  <p>I am wondering how i can fix it. </p>
  
  <ul>
  <li>I tried in my docker-compose file with
  <code>network_mode: "host"</code>, it is not working (MacOS).</li>
  <li>I tried to use host.docker.internal, but as I am a free plan user, ngrok does not allow me to specify a hostname.</li>
  </ul>
  
  <p>any help is appreciated! Thanks.</p>
  
  <p>here is my docker-compose file:</p>
  
  <pre><code>    ngrok:
          image: wernight/ngrok
          ports:
              - '4040:4040'
          environment:
              - NGROK_PORT=8000
              - NGROK_AUTH=${NGROK_AUTH_TOKEN}
          network_mode: "host"
  </code></pre>