Docker Community Forums

Share and learn in the Docker community.

Docker-composer wait services

docker

(Rombo50) #1

Hello. I have problems with my docker-composer. I want the v8 service to wait until the migration is complete. But it starts the manage.py immediately after the service “migration” has been started.

Thank you in advance!

version: '3.3'
services:
  redis:
    image: redis
    ports:
        - '6379:6379'
  migration:
    image: 10.10.13.20:5000/v8:latest
    command: /srv/v8/bin/python2.7 /srv/v8/project/manage.py migrate
    volumes:
      - .:/code
  v8:
    container_name: 'v8'
    image: 10.10.13.20:5000/v8:latest
    command: /srv/v8/bin/python2.7 /srv/v8/project/manage.py runserver 0.0.0.0:8001
    volumes:
      - .:/code
    ports:
      - "8001:8001"
    depends_on:
      - redis
      - migration