Wait-For-It can be used to synchronize spinning up of interdependent services.
1.1K
Wait for it is a simple dockerized version of the script wait-for-it build at Stackroute.
Wait-For-It can be used to synchronize spinning up of interdependent services.
Let's say that you have a docker-container B depending on an other docker-container A.
Container A gets started but there are certain services in container A which are yet to be available. Since the container A got started, Container B thinks that the services in container A are also available. Now when container B tries to connect the service available in container A it says connection refused.
Now Wait-For-It basically attempts to solve the problem by listening on the url of the service.
Wait Wait-For-It itself has no clue on what service it should wait. Then how would it work?. Well it's super simple. It involves two simple steps:
Define Services for which you want to wait in wait.txt.
// If you know the url of the service.
// For Example: bolt://172.23.238.135
mongodb://172.23.238.135
// If host and port are present as the environment variable. MONGO_HOST and MONGO_PORT are the environmental variables here
$MONGO_HOST:$MONGO_PORT
Use the wait service in wait-for-it.
version: '2'
services:
wait:
volumes:
- ./wait-for-it:/dependencies
Content type
Image
Digest
Size
17.8 MB
Last updated
about 9 years ago
docker pull jainnish94/wait-for-it