title: airflow runs connections check against metadata db before init db
body: <p>I am running airflow locally based on <code>dockerfile, .env, docker-compose.yaml and entrypoint.sh</code></p>
  <p>as <code>&quot;docker-compose -f docker-compose.yaml up&quot;</code></p>
  <p>And just after <code>&quot;airflow init db&quot;</code> <strong>in entrypoint.sh</strong> I am getting the following error:</p>
  <p><em>[after it all is cool, I can run airflow. But this drives me crazy. Can anyone help me to resolve it, please?]</em></p>
  <p>what's strange is that service queries the tables even before the db has been initiated</p>
  <pre><code>airflow_webserver  | initiating db
  airflow_webserver  | DB: postgresql://airflow:***@airflow_metadb:5432/airflow
  airflow_webserver  | [2022-02-22 13:52:26,318] {db.py:929} INFO - Dropping tables that exist
  airflow_webserver  | [2022-02-22 13:52:26,570] {migration.py:201} INFO - Context impl PostgresqlImpl.
  airflow_webserver  | [2022-02-22 13:52:26,570] {migration.py:204} INFO - Will assume transactional DDL.
  airflow_metadb     | 2022-02-22 13:52:26.712 UTC [71] ERROR:  relation &quot;connection&quot; does not exist at character 55
  airflow_metadb     | 2022-02-22 13:52:26.712 UTC [71] STATEMENT:  SELECT connection.conn_id AS connection_conn_id 
  airflow_metadb     |    FROM connection GROUP BY connection.conn_id 
  airflow_metadb     |    HAVING count(*) &gt; 1
  airflow_metadb     | 2022-02-22 13:52:26.714 UTC [72] ERROR:  relation &quot;connection&quot; does not exist at character 55
  airflow_metadb     | 2022-02-22 13:52:26.714 UTC [72] STATEMENT:  SELECT connection.conn_id AS connection_conn_id 
  airflow_metadb     |    FROM connection 
  airflow_metadb     |    WHERE connection.conn_type IS NULL
  airflow_webserver  | [2022-02-22 13:52:26,733] {db.py:921} INFO - Creating tables
  </code></pre>
  <hr />
  <pre><code>airflow 2.2.3
  postgres 13
  </code></pre>
  <hr />
  <p>in dockerfile:</p>
  <pre><code>ENTRYPOINT [&quot;/entrypoint.sh&quot;]
  </code></pre>
  <hr />
  <p>in docker-compose.yaml:</p>
  <pre><code>webserver:
      env_file: ./.env
      image: airflow
      container_name: airflow_webserver
      restart: always
      depends_on:
        - postgres
      environment:
        &lt;&lt;: *env_common
        AIRFLOW__CORE__LOAD_EXAMPLES: ${AIRFLOW__CORE__LOAD_EXAMPLES}
        AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: ${AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION}
        EXECUTOR: ${EXECUTOR}
        _AIRFLOW_DB_UPGRADE: ${_AIRFLOW_DB_UPGRADE}
        _AIRFLOW_WWW_USER_CREATE: ${_AIRFLOW_WWW_USER_CREATE}
        _AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME}
        _AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD}
        _AIRFLOW_WWW_USER_ROLE: ${_AIRFLOW_WWW_USER_ROLE}
        _AIRFLOW_WWW_USER_EMAIL: ${_AIRFLOW_WWW_USER_EMAIL}
      logging:
        options:
          max-size: 10m
          max-file: &quot;3&quot;
      volumes:
        - ./dags:bla-bla
        - ./logs:bla-bla
      ports:
        - ${AIRFLOW_WEBSERVER_PORT}:${AIRFLOW_WEBSERVER_PORT}
      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>
  <hr />