My current docker-compose.yml -
# This docker-compose file uses '.env' file present in the current directory, 
# for database credentials. If you want to change the credentials please 
# change the data in '.env'.
# '.env' file might be hidden as dot files are hidden please unhide to see it.
# Know more about '.env' file: https://docs.docker.com/compose/env-file/
version: '3'
services: 
  postgresdb:
    image: postgres:9.5
    environment: 
      POSTGRES_USER: ${ENV_POSTGRES_USER}
      POSTGRES_PASSWORD: ${ENV_POSTGRES_PASSWORD}
      POSTGRES_DB: ${ENV_POSTGRES_DB}
    volumes: 
      - "../app/volumes/postgres/data:/var/lib/postgresql/data"
  # This is python service. It uses python 3.6 as base image.
  # It will build this service using the Dockerfile present in current directory
  # To modify the values of environment variables please open '.env' file.
  # This service will not run until postgresdb service gets started
  python-app:
    image: python:3.6
    build: .    # Builds using Dockerfile from current directory
    depends_on: 
      - postgresdb
    ports: 
      - "5001:5001"
    tty: true
    volumes: 
      - "../app/volumes/trained_knn_model.clf:/usr/src/app/my-app/trained_knn_model.clf"
      - "../app/volumes/XYPickle.pickle:/usr/src/app/my-app/XYPickle.pickle"
    environment: 
      - POSTGRES_USER=${ENV_POSTGRES_USER}
      - POSTGRES_PASSWORD=${ENV_POSTGRES_PASSWORD}
      - POSTGRES_HOST=${ENV_POSTGRES_HOST}
      - POSTGRES_PORT=${ENV_POSTGRES_PORT}
      - POSTGRES_DB=${ENV_POSTGRES_DB}
My docker-compose.yml file contains 2 services. I have specified postgrasdb service to start before python-app service using depends_on but the docker-compose in not running the services in specified order.
How can I get postgrasdb service to be run before python-app service? I am running docker-compose up --build --remove-orphans command.
 
     
    