'Docker-compose postgres cant init my tables in newly created database

I am trying to automate the INIT process in Docker so whenever I docker-compose up in an empty data directory it will create two DBS 1st one is Airflow and the second one is my test DB so for instance when I docker-compose up Postgres run the first SQL file in my new test DB to create tables. However, it didn't run the insert SQL files I have already mounted in docker-entry point what is does it run those files in the Airflow database can anyone tell me how to insert all metadata tables in my Test Database instead of airflow one thanks

My docker-compose file

  postgres:
    image: postgres:13

    environment:
      POSTGRES_USER: airflow
      POSTGRES_PASSWORD: airflow
      POSTGRES_MULTIPLE_DATABASES: airflow ,docker_airflow

    ports: 
    - "5432:5432"

    volumes:
      - postgres-db-volume:/var/lib/postgresql/data
      - ../data-platform/db/metadata/init/1._ddl.sql:/docker-entrypoint-initdb.d/1._ddl.sql
      - ../data-platform/db/metadata/init/2._init.sql:/docker-entrypoint-initdb.d/2._init.sql
      - ../data-platform/db/metadata/init/3._props.sql:/docker-entrypoint-initdb.d/3._props.sql
      - ../data-platform/db/metadata/init/4.ge_ddl.sql:/docker-entrypoint-initdb.d/4.ge_ddl.sql
      - ../data-platform/db/metadata/init/5.ge_init.sql:/docker-entrypoint-initdb.d/5.ge_init.sql
      - ../data-platform/db/metadata/init/6._be_lu_nl.sql:/docker-entrypoint-initdb.d/6._be_lu_nl.sql
      - ../data-platform/db/metadata/init/7._registration_nl_lifecycle.sql:/docker-entrypoint-initdb.d/7._registration_nl_lifecycle.sql

    healthcheck:
      test: ["CMD", "pg_isready", "-U", "airflow"]
      interval: 5s
      retries: 5
    restart: always


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source