Giter VIP home page Giter VIP logo

docker-wait-for-dependencies's Introduction

Yourproject logo

Docker wait for dependencies

GitHub Issues GitHub Pull Requests Test GitHub release (latest by date) LICENSE Renovate

Docker Pulls amd64 arm64


A simple container that puts itself on hold until the other services declared in the docker-compose.yml are accessible via TCP.
Available for linux/amd64 and linux/arm64 architectures.

Example usage:

Sample docker-compose.yml:

version: '2'
services:
  mongo:
    image: mongo:6
    container_name: mongo
    ports:
      - 27017:27017
    networks:
      - my-network

  redis:
    container_name: redis
    image: redis:6
    ports:
      - 6379:6379
    networks:
      - my-network

  server:
    container_name: server
    image: server
    ports:
      - 3000:3000
    networks:
      - my-network

  start_dependencies:
    image: drevops/docker-wait-for-dependencies:23.12.0
    depends_on:
      - mongo
      - redis
    container_name: wait-for-dependencies
    command: mongo:27017 redis:6379
    networks:
      - my-network

Then, to guarantee that mongo and redis are ready before running server:

$ docker-compose run --rm start_dependencies
# Some output from docker compose
$ docker-compose up server

By default, there will be a 2 second sleep time between each check. You can modify this by setting the SLEEP_LENGTH environment variable:

  start_dependencies:
    image: drevops/docker-wait-for-dependencies:23.12.0
    environment:
      - SLEEP_LENGTH: 0.5

By default, there will be a 300 seconds timeout before cancelling the wait_for. You can modify this by setting the TIMEOUT_LENGTH environment variable:

  start_dependencies:
    image: drevops/docker-wait-for-dependencies:23.12.0
    environment:
      - SLEEP_LENGTH: 1
      - TIMEOUT_LENGTH: 60

Acknowledgments

The main functionality is based on the docker-wait-for-dependencies project. A special thank you to the contributors for their original work.


Repository created using https://getscaffold.dev/ project scaffold template

docker-wait-for-dependencies's People

Contributors

renovate[bot] avatar alexskrypnyk avatar tannguyen04 avatar

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.