version: "3.7" services: exam-base: build: context: ../base dockerfile: dockerfile image: "exam-base" container_name: ${PG_CONTAINER_NAME} environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} PGDATA: ${PGDATA} volumes: - exam-base:${PGDATA} - exam-prebase:/var/lib/postgresql/data - ./scripts/init-database.sh:/docker-entrypoint-initdb.d/init-database.sh ports: - "5430:5432" restart: unless-stopped volumes: exam-base: external: true exam-prebase: external: true networks: default: name: exam-net external: true driver: bridge