I have a Compose file with 10 services. I want to start only 8 of them. I can do docker-compose up srv1 srv2 srv3 srv4 srv5 srv6 srv7 srv8
but it would be better to do docker-compose up --exclude srv9 srv10
. Useful syntactic sugar IMO.
Is it common that you'd want to start a regular subset? If so then perhaps using extends
would help the use case. Compose is meant to model an application / common set of container deployments. Not sure how common wanting to start a project that is missing a couple of containers would be (although happy to be enlightened!).
Judging by the fact that Compose already supports starting a subset, I would say that it's common enough. Many other commands, not only up
, also allow to specify the services by name. The current syntax makes it easy to specify a limited subset of the services (2 or 3) as opposed to a larger one.
For my team it's very common to start all services apart of particular one. That's the case where you are developing some microservices and want to run all of them on your machine (using docker-compose) apart of that single one that you are currently developing and running from your IDE (for example in the debug mode). So that's :+1: from me for --exclude. But that --exclude should also override dependencies - if I don't want to start something it should never start :)
I'm facing the same situation as @pmzajaczkowski. Having this feature is quite useful when testing microservices locally.
+1 on suggestion. Definitely useful for my team
+1
+1
+1
My use case is that we have a handful of microservices, and I'm developing one of them. I want to docker-compose up --exclude <service under development>
, which I then start myself; for clearer logging, custom environment, under hot-reload modes, etc.
Second that.
This would be super helpful.
Would appreciate if you guys consider this for a future release.
+1
Workaround:
docker-compose up --scale foo=0
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
pls
+1
This would be super useful!
Workaround #2:
docker-compose config --services | magic_grep | xargs docker-compose up
the advantage is that you can have a fancy grep pattern, like exclude frontend-* or keep only *db.
+1
While this can be deployed using
docker-compose up -d scale=0 <service>
it would be far more useful to be able to specify a service that needs to be specified explicitly through a docker-compose
command - or only brought up by a depends_on
reference in another service - in the docker-compose.yaml
file.
For my team it's very common to start all services apart of particular one. That's the case where you are developing some microservices and want to run all of them on your machine (using docker-compose) apart of that single one that you are currently developing and running from your IDE (for example in the debug mode). So that's 👍 from me for --exclude. But that --exclude should also override dependencies - if I don't want to start something it should never start :)
I'd prefer to see an option for both cases: e.g. I have a site in a container dependent on a running nginx service, but both are "disabled" from running through a standard docker-compose up
(e.g. for a local dev environment) - but if I run docker-compose up <my site service>
, I'd want it to still bring up the nginx service with it.
+1
+1 This would be very useful for me too.
My use case is most of the time I want to run all services in my docker-compose.yml
file except one b/c it's a service that is a resource hog and is only need when i'm testing pieces of my app locally.
Only sometimes do I want to run literally everything in my docker-compose.yml
file.
While this can be deployed using
docker-compose up -d scale=0 <service>
it would be far more useful to be able to specify a service that needs to be specified explicitly through a
docker-compose
command - or only brought up by adepends_on
reference in another service - in thedocker-compose.yaml
file.
@Rohaq I believe you meant docker-compose up --scale <service>=0
You can split your yml into two, moving the often offending service there.
When you need, you combine both yml.
--
Fernando 🐼
On Fri, 15 Nov 2019, 21:23 Tom Caflisch, notifications@github.com wrote:
+1 This would be very useful for me too.
My use case is most of the time I want to run all services in my
docker-compose.yml file except one b/c it's a service that is a resource
hog and is only need when i'm testing pieces of my app locally.Only sometimes do I want to run literally everything in my
docker-compose.yml file.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/docker/compose/issues/4133?email_source=notifications&email_token=AABJDLQSZTAW2JIOQGWVJBTQT4HMXA5CNFSM4CVXDOWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEGYFLI#issuecomment-554533549,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABJDLQRUWWCKLFG44E6TBLQT4HMXANCNFSM4CVXDOWA
.
Run into similar need today. +1
+1
+1
+1
+1 is not helpful and is only email spam for those who are following this issue...
my use case is similar but different enough to mention. I'd like to --exclude from docker-compose log. There's one chatty service I'm not interested in seeing but rather than listing all services, it'd be useful to --exclude the one.
@eliam docker-compose logs | grep -v <service_name>
inverse grep will filter for you
@eliam
docker-compose logs | grep -v <service_name>
inverse grep will filter for you
Yes, thanks, I'm familiar. I'd normally be following these logs, i.e."docker-compose -f --tail=5" but irrespective, I'm not sure producing output to ignore is how I'd go, if --exclude functionality existed.
There's a proposal for profiles in Compose that potentially can fill this gap. Feel free to check it out and contribute to the discussion here: https://github.com/compose-spec/compose-spec/issues/97
Most helpful comment
Workaround: