简体   繁体   中英

Docker service depends, doesn't work after restart docker service

Services in docker-compose with depends on condition (healthy) are working well after docker-compose up -d But after restarting docker daemon ( service docker restart ) or server reboot, all services start at the same time and it seems that the depends on condition doesn't apply.

version: "2.4"
services:
      serviceA:
        ...
        restart: unless-stopped
        depends_on:
          serviceB:
            condition: service_healthy
        ...

According to your text it seems like that you have syntax error and condition: part is wrong ! (didn't see anything on docker references about condition)

You should use depends_on

Express dependency between services.

depends_on:
  - db
  - redis
redis:
   image: redis
db:
   image: postgres

The following documentation will help you better

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM