Мой текущий 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}
Мой файл docker-compose.yml содержит 2 службы.Я указал службу postgrasdb для запуска до службы python-app с использованием depends_on
, но docker-compose не запускает службы в указанном порядке.Как я могу получить службу postgrasdb для запуска до службы python-app ?Я выполняю команду docker-compose up --build --remove-orphans
.