-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Depends_on in version3 #4305
Comments
HTH |
But i have written a docker-compose v3 and i try to deploy on swarm but depends_on is not working as the container are not starting in the fashion in which they have to be started. |
Are you using |
I am using docker stack deploy |
What would be the equivalent on docker-compose v3 to achieve something like healthcheck dependencies? If you are going to drop that functionality in v3 one should basically never use it, or at least there should be a migration path for this. What are the intentions to introduce it in a new docker-compose v2.1 and then dropping it for v3? I'm currently setting up different compose files for our applications, but I don't want to use features which are getting dropped in the next version and therefore preventing use from updating to a newer docker-compose file version. |
At the moment, you should assume that the new I know that's not the answer a lot of people want, but I hope that helps give some clarity at least. |
Can I ask why it is not in plans? I assume it would be very useful to do so. |
It gives clarity, but doesn't explain. Can you elaborate on the why? And on the alternatives (if they exist)? |
@shin- why did you implement it at all in 2.1, then? If people use it and come to depend on it, they will never be able to upgrade. With all due respect, that seems like very poor planning on your guys' part. |
So what is the supported depends_on syntax for v3? https://docs.docker.com/compose/compose-file/#version-3 does not mention depends_on, and when I use docker-compose v1.10 to deploy an application neither the v2 or v2.1 depends_on flavours work for me in a v3 compose file... |
From moby/moby#30404 (comment)
When using The version 3 format is the first step in moving away from the external |
Thanks. Now it makes sense. |
IMHO this is not a good approach. Not all services can properly detect the other services they depend are not ready, they try many times then fail, so container might die later. We still need to introduce entrypoint wrapper scripts, which is not very nice. Healthy-check dependence was very nice, but it just does not support swarm mode. |
Hey everyone! |
@Marvel77 By default, yes, but you can override that behavior using the |
@shin- Thank you very much! |
@mustafaakin Actually, the best practice is (IMHO) to have fault tolerant connection to the services you depend on. For example, if you use a database, you might delay startup until it's responding. But how do you handle a restart of the database? Your app should be able to recover from this, and then you don't need to depend on 'depend_on' either. |
@hsmade But almost all init (upstart,systemd) have depends on relationship. So it is not that being lazy, it is what makes sense. SSHD daemon does not start until you have your network device ready. I have no control over all the systems I have, yes I can make my systems be fault tolerant. But assume A depends on B. A takes a while to initialize, it is not very deterministic. So, how can you write a restart policy on B? restart forever? What if you do not want that? This is a bigger problem than Compose, Compose just starts them. Swarm is what makes them run, so I think Swarm should handle this dependence on health relationship. |
@mustafaakin I don't think you can compare running micro services in a containerized environment with the classic init systems. That doesn't really make sense. I think the idea of micro services is that they are self-contained, minimal entities. They have a very clear definition of their API, etc. They should not assume any status of their external world. Yes, it would need a database, but no, you can't assume it's there. As I tried to say, knowing that your dependency is there on startup is the least of your problems, handling it well when it goes away is more important, and should solve the former as well. But then again, these are my thoughts on the matter, and I could be wrong ;) |
Yeah, it does not make sense for microservices, but not everything is a microservice, I run Hadoop in a container. Docker is not for only microservices. As I said, its great for the environments I have control, but in the things that I do not have control, it requires wrapping the entrypoint of services. It was just solved with depends_on with healtcheck, I just think it would be great to have it in Swarm as well. Restarting contionously is just a lazy man's choice. |
Guys, I think there is a kind of mis-conception of "fault-tolerant" and a kind of "first-time initialization". Having continuous restarts at initialization phase and waiting for the services at some point start in the proper order by themselves is like a nightmare - one cannot plan any "downtime" for the startup process should the worse happen. Not only the worse, but sometimes there are like say "maintenance" time when something needs to change and nobody would be able to predict how much time it would take for the system to actually start, because different services are restarted by swarm over and over again waiting for the proper order. I don't think I can quite enter in "production" without such a predictability even though it's supposed to happen rarely (full down) - best never happen. |
@ozlatkov This should really be posted on the docker/docker issue tracker, not here. |
@shin- Thank you! I've moved it to docker/docker tracker: |
I think it is really bad that the Docker team assumes Docker Swarm is used. Compose is supposed to a totally functional standalone tool. We do however use Docker Compose a lot in our testing pipelines and such a fundamental REMOVAL of features (without giving a workable alternative) is really having a dramatic negative effects on your users. I am currently reviewing a very ugly PR from my team members where they are trying to come up with all sorts of workarounds to this (since we rely heavily on this functionality), including staying on Compose 2.X for all eternity. Docker is supposed to help us get to our goals, not make it more difficult by removing critical features many teams already rely on. Please reconsider porting all of this into Docker Compose 3. Much appreciated. |
For the 100th time now: There's no reason to use the v3 format if you don't intend to use swarm services. |
Does that mean the team is committing to supporting the 2.X formats for those that are using compose as a standalone development tool? |
Exactly my question: is the Compose team committed to supporting the v2 format forever? We cannot standardize on Docker Compose if the v2 format is scheduled for deprecation any time. |
I feel like this forces all containers into an |
What is the declarative equivalent of docker-compose.yml for a stack? |
Hi guys, what's the best practice if I intend to use docker stack and get rid of docker-compose? This seems to be the solution, but having sort of hacky scripts to init containers doesn't sound like a good practice. Does it? Thanks. @mustafaakin Thanks for your downvote! Very helpful ❤️ |
@VinceOPS I'm not sure about "best practice" but I've been using healthchecks and |
@hutchic But as mentioned in the above conversation, it could not have an end date, some kind of a circular on-failure restart. |
Why the docker team remove this feature in version3 and reject to add those in? |
@tianhao-au see the discussion on moby/moby#31333 (and moby/moby#31333 (comment)) |
For compose, I also left a suggestion in moby/moby#31333 (comment) (have a |
This change of feature is literally why I don't use docker-compose any longer. If I am using docker in production and docker-compose locally for dev environments I am now required to make my docker containers behave radically different in dev than in production. In production I rely on an orchestration system to insure the health and order of my deployments. In dev land that orchestration was being done by docker-compose. Now I'm writing a bunch of mangled scripts to check health of things to orchestrate my system. If I'm gonna do that why not just write some golang to manage my dockers and be done with it. A little bummed it was dropped. Just my 2p |
Trying to use the latest docker-compose version to make things more future-proof and stumbled upon this issue. This is sad. |
Hi i would like to know what is the alternate of depends_on in docker-compose v3 as in the release notes you said we will jot port the depends_on feature in v3
The text was updated successfully, but these errors were encountered: