title: How avoid docker-compose up ignoring a dockerfile?
body: <p>I'm trying to modify an Airflow docker-compose set-up with an extended image from a Dockerfile to have dbt installed on the container but the docker-compose file seems to be ignoring the Dockerfile: the different airflow containers are launched and run correctly but not a single one has dbt (fully) installed. I get the following error :</p>
  <pre><code>root@42b2358a7792:/opt/airflow# dbt --version
  Traceback (most recent call last):
    File &quot;/home/airflow/.local/bin/dbt&quot;, line 5, in &lt;module&gt;
      from dbt.main import main
  ModuleNotFoundError: No module named 'dbt'
  
  </code></pre>
  <p>The docker-compose.yml file:</p>
  <pre><code>version:                                        &quot;3.7&quot;
  #https://github.com/compose-spec/compose-spec/blob/master/spec.md#using-extensions-as-fragments
  
  # Airflow extensions
  x-airflow-common:                               &amp;airflow-common
    build:                                        .
    environment:                                  &amp;airflow-common-env
      AIRFLOW__CORE__EXECUTOR:                    CeleryExecutor
      AIRFLOW__CORE__SQL_ALCHEMY_CONN:            postgresql+psycopg2://airflow:airflow@postgres/airflow
      AIRFLOW__CELERY__RESULT_BACKEND:            db+postgresql://airflow:airflow@postgres/airflow
      AIRFLOW__CELERY__BROKER_URL:                redis://:@redis:6379/0
      AIRFLOW__CORE__FERNET_KEY:                  ''
      AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
      AIRFLOW__CORE__LOAD_EXAMPLES:               'true'
      AIRFLOW__API__AUTH_BACKEND:                 'airflow.api.auth.backend.basic_auth'
    volumes:
      - ./dags:/opt/airflow/dags
      - ./logs:/opt/airflow/logs
      - ./plugins:/opt/airflow/plugins
  
    user:                                         &quot;${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-50000}&quot;
    depends_on:
      redis:
        condition:                                service_healthy
      postgres:
        condition:                                service_healthy
  
  
  services:
   
    # Database
    postgres:
        image:                                    postgres:13
        environment:
          POSTGRES_USER:                          airflow
          POSTGRES_PASSWORD:                      airflow
          POSTGRES_DB:                            airflow
        volumes:
          - postgres-db-volume:/var/lib/postgresql/data
        healthcheck:
          test:                                   [&quot;CMD&quot;, &quot;pg_isready&quot;, &quot;-U&quot;, &quot;airflow&quot;]
          interval:                               5s
          retries:                                5
        restart:                                  always
        ports:
                - 5432:5432
  
    # Airflow services
    redis:
        image:                                    redis:latest
        container_name:                           airflow-redis
        ports:
          - 6379:6379
        healthcheck:
          test:                                   [&quot;CMD&quot;, &quot;redis-cli&quot;, &quot;ping&quot;]
          interval:                               5s
          timeout:                                30s
          retries:                                50
        restart:                                  always
    airflow-webserver:
        &lt;&lt;:                                       *airflow-common
        container_name:                           airflow-webserver
        command:                                  webserver
        ports:
          - 8080:8080
        healthcheck:
          test:                                   [&quot;CMD&quot;, &quot;curl&quot;, &quot;--fail&quot;, &quot;http://localhost:8080/health&quot;]
          interval:                               10s
          timeout:                                10s
          retries:                                5
        restart:                                  always
    airflow-scheduler:
        &lt;&lt;:                                       *airflow-common
        container_name:                           airflow-scheduler
        command:                                  scheduler
        healthcheck:
          test:                                   [&quot;CMD-SHELL&quot;, 'airflow jobs check --job-type SchedulerJob --hostname &quot;$${HOSTNAME}&quot;']
          interval:                               10s
          timeout:                                10s
          retries:                                5
        restart:                                  always
    airflow-worker:
        &lt;&lt;:                                       *airflow-common
        container_name:                           airflow-worker
        command:                                  celery worker
        healthcheck:
          test:
            - &quot;CMD-SHELL&quot;
            - 'celery --app airflow.executors.celery_executor.app inspect ping -d &quot;celery@$${HOSTNAME}&quot;'
          interval:                               10s
          timeout:                                10s
          retries:                                5
        restart:                                  always
  
    airflow-init:
        &lt;&lt;:                                       *airflow-common
        container_name:                           airflow-init
        command:                                  version
        environment:
          &lt;&lt;:                                     *airflow-common-env
          _AIRFLOW_DB_UPGRADE:                    'true'
          _AIRFLOW_WWW_USER_CREATE:               'true'
          _AIRFLOW_WWW_USER_USERNAME:             ${_AIRFLOW_WWW_USER_USERNAME:-airflow}
          _AIRFLOW_WWW_USER_PASSWORD:             ${_AIRFLOW_WWW_USER_PASSWORD:-airflow}
  
  
  
  volumes:
    workspace:
       name:                                      ${WORKSPACE_DOCKER_MOUNT}
    data:
       name:                                      ${DATA_DOCKER_MOUNT}
    db:
       name:                                      ${DB_DOCKER_MOUNT}
    postgres-db-volume:
  
  </code></pre>
  <p>The dockerfile:</p>
  <pre><code>FROM apache/airflow:2.1.0
  RUN apt-get update \
    &amp;&amp; apt-get install -y --no-install-recommends \
           vim \
    &amp;&amp; apt-get autoremove -yqq --purge \
    &amp;&amp; apt-get clean \
    &amp;&amp; rm -rf /var/lib/apt/lists/*
  RUN apt-get install -y git libpq-dev python-dev python3-pip
  RUN apt-get remove python-cffi
  RUN pip install --upgrade cffi
  RUN pip install cryptography~=3.4
  RUN pip install dbt==0.19.0
  </code></pre>
  <p>I have tried directly building the image are the service level and changing the Dockerfile with only RUN pip install dbt==0.19.0 but it won't work.
  The only alternative, which I would like to avoid is manual installation.</p>
  <p>Any ideas why docker-compose is ignoring the Dockerfile ?</p>