Comments (7)
No, unfortunately this does not work with v3 of docker compose. From v3 they are not supporting the condition
syntax, as you have pointed out. Docker want to move away from docker-compose
to the integrated docker stack
and Swarm services. When designing how these should work it seems that Docker have made a conscious decision not to support features that wait for containers to be in a "ready" state. They argue that applications depending on other systems should be resilient to failure.
This is a couple of paragraphs taken from the documentation here that explains their reasoning.
The problem of waiting for a database (for example) to be ready is really just a subset of a much larger problem of distributed systems. In production, your database could become unavailable or move hosts at any time. Your application needs to be resilient to these types of failures.
To handle this, your application should attempt to re-establish a connection to the database after a failure. If the application retries the connection, it should eventually be able to connect to the database.
So the options are:
- Keep using the v2 format
- Use a tool like wait-for-it or dockerize
- Make your application resilient to database failure and able to retry it's connection on startup
There is some discussion about this issue here and here.
from docker-compose-healthcheck.
This is supported in newer versions of docker-compose which support the compose specification. Verified with docker-compose 1.28.4 here.
cc @unparalleled-js
from docker-compose-healthcheck.
Tested and updated the readme. Basically, it doesn't matter what the version
property is set to anymore because it's not used. Recent versions of Docker Compose follow the Compose Specification which allows features from previous versions of Compose to be used together.
I think we can consider this issue resolved.
from docker-compose-healthcheck.
You could invoke Docker API, as documented here.
from docker-compose-healthcheck.
You might want to make a note in your README that this solution doesn't work as of docker-compose V3
from docker-compose-healthcheck.
Added a note to the readme about this issue. Thanks.
from docker-compose-healthcheck.
@shane-axiom Thanks for letting me know! I had no idea about this change.
Docker Compose 1.27.0+ implements the format defined by the Compose Specification. Previous Docker Compose versions have support for several Compose file formats – 2, 2.x, and 3.x. The Compose specification is an unified 2.x and 3.x file format, aggregating properties across these formats.
ref: https://docs.docker.com/compose/compose-file/
It aggregates properties across all the past formats, so you can now use the 2.x condition
syntax with the latest version of compose. Perhaps it only works if you don't specify the version at the top of the compose file? I see that the version
property is optional now. Anyway, I'll test it out and update this repository.
from docker-compose-healthcheck.
Related Issues (10)
- Version 3 no longer supports the condition form of depends_on. HOT 2
- pg_ready ignores provided arguments. HOT 2
- healthcheck condition is not supported in docker compose file v3 HOT 1
- FATAL: role "root" does not exist HOT 21
- nginx: [error] init_by_lua error: New migrations available; run 'kong migrations up' to proceed HOT 1
- [lua] balancers.lua:240: create_balancers(): failed loading initial list of upstreams: failed to get fromams: failed to get from node cache: could not acquire callback lock: timeout, context: ngx.timer HOT 1
- Ingtegrate blog posts with github HOT 1
- FATAL: role "root" does not exist HOT 4
- n/a HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-compose-healthcheck.