title: Docker + Airflow - Unable to connect to MySQL on host from docker container
body: <p>I'm using dockerized Airflow based on 'puckel/docker-airflow:1.10.9' image.</p>
  <p><strong>docker-compose</strong> file is the following:</p>
  <pre><code>version: '3.5'
  
  services:
    postgres:
      image: postgres:12.3-alpine
      environment:
        POSTGRES_DB: airflow
        POSTGRES_USER: airflow
        POSTGRES_PASSWORD: airflow
      ports:
        - 5432:5432
      volumes:
        - ./data/postgres:/var/lib/postgresql/data
  
    webserver:
      build:
        context: .
        dockerfile: docker/development/webserver/Dockerfile
      restart: always
      depends_on:
        - postgres
      environment:
        ...
      volumes:
        ...
      ports:
        - 8080:8080
      command: webserver
      healthcheck:
        test: [&quot;CMD-SHELL&quot;, &quot;[ -f /usr/local/airflow/airflow-webserver.pid ]&quot;]
        interval: 30s
        timeout: 30s
        retries: 3
  </code></pre>
  <p>Connection to MySQL on host is required in one of the tasks in DAG.</p>
  <p><strong>Connection details are the following:</strong>
  <a href="https://i.stack.imgur.com/9Rymy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Rymy.png" alt="enter image description here" /></a></p>
  <p>When I'm trying to trigger DAG, the task instance fails with <code>_mysql_exceptions.OperationalError: (2006, &quot;Unknown MySQL server host 'host.docker.internal' (-2)&quot;)</code></p>
  <p>I've tried the same as in <a href="https://stackoverflow.com/a/24326540/11049364">this issue</a>, but the problem still persists.</p>
  <p>Also, here are some failed docker network checks:</p>
  <pre><code>$ docker run --rm webserver ping 'host.docker.internal'
  
  ping: bad address 'host.docker.internal'
  
  </code></pre>
  <p>and</p>
  <pre><code>$ docker run --rm alpine nslookup host.docker.internal
  
  Unable to find image 'alpine:latest' locally
  latest: Pulling from library/alpine
  df20fa9351a1: Pull complete 
  Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
  Status: Downloaded newer image for alpine:latest
  Server:         192.168.100.1
  Address:        192.168.100.1:53
  
  ** server can't find host.docker.internal: NXDOMAIN
  
  ** server can't find host.docker.internal: NXDOMAIN
  
  
  </code></pre>