-
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
introduce a config option to not auto-up services #3047
Conversation
I'd love to see this merged. This now conflicts with master. Please take a look into it. |
@moriyoshi I rebased my commit on the current master and so resolved the merge conflicts. |
8196740
to
187c0fc
Compare
This is a PoC implementation of solution 2) from docker#1896: It adds the config option "auto_up" as boolean to mark a service to not start by default when calling "docker-compose up" but instead only when given explicitly or pulled in as a dependency of another service. TODO: update tests and comments for changed functions Signed-off-by: Roman Anasal <roman.anasal@academyconsult.de>
+1 for getting some attention on this PR from one of the repo maintainers. It's a bit of a travesty that such a simple feature doesn't exist already, let alone that the implementation has been ignored for almost a year. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to see this feature! Thanks, @acran for taking the time to implement this.
+1 |
@shin- anything that needs to be done here to get it in? |
Why this PR has been forgotten ? |
What is the current way of doing the same as described in this PR until it's merged? |
Currently the only way to do is to outsource the definition of the optional service into its own |
Closing for the reasons highlighted in #1896 (comment) - please use a separate Compose file for services that need to be started separately. |
This is a truly sad state of affairs. @acran 's last post nails it 100% in #1896 By closing the comments in the other thread the demand won't go away. People will keep on requesting this. Why? Because it makes 100% sense. To everybody except you apparently @shin- |
Vagrant has the option for the images and it's really cool to use ! https://www.vagrantup.com/docs/multi-machine/#autostart-machines |
+1 |
Hi @shin- In #1896 you said "The thread is still unlocked and will continue to be as long as people refrain from being mean or impolite." @acran's last post in #1896 does seem to sum up popular sentiment about this whole situation (source: reactions above), and that post seems neither mean nor impolite. So whilst I'd agree that popular sentiment can be misguided, I would have loved to see a reasoned rebuttal of those points (or graceful accession to the evident demand!), rather than shutting down a mostly well-intentioned discussion. |
Is auto_up option working or not ? |
The code in this branch/PR is working, but it was never merged into the master but just closed and so is not available in upstream |
To refuse this PR is such a poor decision. To get you the case: We defined several services that should be started by So instead of
We need to call
This is totally inconvenient. The PR would bring a huge benefit for docker-compose. Please rethink your decision @shin- |
Here is another use-case. I am developing a messaging course with Apache Kafka. I selected docker-compose over Kubernets because it is much simpler to use. |
Hi @shin We also have a use case. Laravel project which sometimes does need a horizon queue for an unspecified time period and sometimes does not need. It is definately a service and not a task, as there is no defined ending moment, it rather means "this environment is providing the service" as opposed to "another environment is providing the service" so your arguments in the other PR that adding this boolean would conflate services and tasks don't make sense for our situation. We currently use the 2 files setup, but that is cumbersome since we have an environment in which it needs to be toggled from time to time, and we cannot keep the override file from git, since it is a large file which also contains lots of other environment specific stuff. so now we have to copy/paste or comment/uncomment a service. not ideal. So, my 2 cents: As this is such a simple boolean property I highly recommend merging this feature and dont see any disadvantages. There are far more exotic things in docker-compose than this. Thanks in advance for reading this and giving it another thought :-) |
I've got a use case as well: I package my version of
And I get the certificates renewed automatically and nginx to immediately use them:
Consequently I do not want this Finally, I don't see why adding a (non-default) option that indicates a container should not be started is a problem in itself. Sometimes getting too much opinionated comes in the way of solving real-life genuine practical user problems. Please just accept the merge request and make people happy, life is too short. Thank you. |
I also have a use case for this. The application I work on depends on multiple services (Redis, Memcached, MongoDB, etc...), however 90% of time I only need a couple of those services running to do my work. I'd prefer if by default only the essential services were launched, and the remaining ones be launched on demand. Launching every service would consume a lot of resources and slow things down unnecessarily. I could use separate docker-compose files but that would just complicate things for no good reason. |
I updated and finalized this PR based on the most recent master. You can find it here: #7548 |
Apparently we need a spec change, not just the code. See compose-spec/compose-spec#87 for an issue to add your 👍 to as well |
Posting an update here for people coming from #1896: It seems like the feature is making actual progress in the form of service profiles. The feature has just been merged into the Compose specification and is open for implementation at #7919 🎉 Reading through the various threads and PRs, it seems like we owe this most to @acran's patient efforts, so thank you :) |
This would depend on the implementation, because profiles does not specify that you should actually create disabled services - you may just skip them as well. |
Here is another use case: We use docker-compose for defining which services to run and how to run them when developing our web app project locally. However, all developers might not want all services to run. As an example: for backend developers working a lot with ElasticSearch it can be very useful to run Kibana to test stuff directly against the ElasticSearch indices, and it would be useful if the setup for this is defined in the compose file. However, a frontend developer that never works with ElasticSearch obviously would not want the Kibana service to hog the resources on their computer. The result is then that the service cannot be added to the compose file, and each backend dev needs to install and configure Kibana manually. |
@tjespe this PR was solved with the new service profiles feature released with All the use cases here can now be implemented with that feature. Thus this PR is obsolete now. |
This is a PoC implementation of solution 2) from #1896:
It adds the config option
auto_up
as boolean to mark a service to not start by default when callingdocker-compose up
but instead only when given explicitly or pulled in as a dependency of another service.The option is
True
by default so behavior when omitting it is the same as before. Whenauto_up: false
is given it should only affectdocker-compose up
anddocker-compose create
(though I'm not 100% sure about any other side effects of this change).Further discussion should take place at #1896.
Still TODO: update docs, tests and comments for the changed functions!