Giter Site home page Giter Site logo

Comments (4)

acran avatar acran commented on May 20, 2024 5

To throw in just another idea (based on the example from @hangyan above):

version: "3"
services:
  web:
    build: .
    depends_on:
      - db
      - redis
  redis:
    image: redis
    depends_on:
      init_container:
        condition: service_finished_successfully
  init_container:
      image: busybox
      command:  ping www.google.com
  db:
    image: postgres

I.e. introduce a new enum value (service_finished_successfully) to the depends_on condition such that the dependent service will only start after the other service exited with a successful exit code - or just exited at all (service_finished).
See https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on and #72

from compose-spec.

EricHripko avatar EricHripko commented on May 20, 2024 3

I like the suggestion from @acran 👍 It seems like a natural extension of Compose language.

from compose-spec.

hangyan avatar hangyan commented on May 20, 2024
version: "3"
services:
  web:
    build: .
    depends_on:
      - db
      - redis
  redis:
    image: redis
    init_container:
      image: busybox
      command:  ping www.google.com
  db:
    image: postgres

Some rough thoughts

from compose-spec.

mikesir87 avatar mikesir87 commented on May 20, 2024

I actually just came across this use case, but I'll admit my first approach/thought was to do it as outlined by @acran. The depends_on already supports some of part of this use case, so adding another enum value makes sense. It also aligns with how ECS thought about it (can't deep-link onto the page, but see the dependsOn section in their task definition parameters).

from compose-spec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.