Skip to content
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

Add --exclude to docker-compose up #4133

Closed
philtay opened this issue Nov 9, 2016 · 46 comments
Closed

Add --exclude to docker-compose up #4133

philtay opened this issue Nov 9, 2016 · 46 comments

Comments

@philtay
Copy link

philtay commented Nov 9, 2016

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.

@johnharris85
Copy link

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!).

@philtay
Copy link
Author

philtay commented Nov 11, 2016

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.

@pmzajaczkowski
Copy link

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 :)

@yohanliyanage
Copy link

I'm facing the same situation as @pmzajaczkowski. Having this feature is quite useful when testing microservices locally.

@DemianTinkiel
Copy link

+1 on suggestion. Definitely useful for my team

@echo-xu
Copy link

echo-xu commented Jan 3, 2018

+1

1 similar comment
@DutchKevv
Copy link

+1

@rangerscience
Copy link

+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.

@er1z
Copy link

er1z commented Mar 3, 2018

Second that.

@cassiocardoso
Copy link

This would be super helpful.

Would appreciate if you guys consider this for a future release.

@TVictor
Copy link

TVictor commented May 2, 2018

+1

@serbaut
Copy link

serbaut commented May 21, 2018

Workaround:

 docker-compose up --scale foo=0

@Flaque
Copy link

Flaque commented Aug 6, 2018

+1

10 similar comments
@evilosa
Copy link

evilosa commented Aug 8, 2018

+1

@adithepnarula
Copy link

+1

@sbz
Copy link

sbz commented Aug 27, 2018

+1

@arcanjoaq
Copy link

+1

@stidiovip
Copy link

+1

@arturdrozdzyk
Copy link

+1

@aleksandrmetik
Copy link

+1

@jkbmaj
Copy link

jkbmaj commented Feb 20, 2019

+1

@dustinlacewell
Copy link

+1

@jasperkamerling
Copy link

+1

@mahaffey
Copy link

pls

@rachelthecodesmith
Copy link

+1

This would be super useful!

@hervenicol
Copy link

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.

@ishpagin
Copy link

+1

@Rohaq
Copy link

Rohaq commented Jun 3, 2019

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.

@Rohaq
Copy link

Rohaq commented Jun 3, 2019

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.

@stidiovip
Copy link

+1

@toymachiner62
Copy link

+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.

@toymachiner62
Copy link

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.

@Rohaq I believe you meant docker-compose up --scale <service>=0

@FernandoMiguel
Copy link

FernandoMiguel commented Nov 15, 2019 via email

@sylwestergryzio
Copy link

Run into similar need today. +1

@michalf-kainos
Copy link

+1

@jmakr0
Copy link

jmakr0 commented Dec 3, 2019

+1

1 similar comment
@banjoh
Copy link

banjoh commented Dec 10, 2019

+1

@mahaffey
Copy link

+1 is not helpful and is only email spam for those who are following this issue...

@eliam
Copy link

eliam commented Oct 19, 2020

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.

@mahaffey
Copy link

mahaffey commented Oct 20, 2020

@eliam docker-compose logs | grep -v <service_name>

inverse grep will filter for you

@eliam
Copy link

eliam commented Oct 20, 2020

@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.

@EricHripko
Copy link

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: compose-spec/compose-spec#97

HansAschenloher pushed a commit to HansAschenloher/compose that referenced this issue Feb 5, 2021
HansAschenloher pushed a commit to HansAschenloher/compose that referenced this issue Feb 6, 2021
see: docker#4133
Signed-off-by: hm-jaschenl <johann.aschenloher0@hm.edu>
@ndeloof
Copy link
Contributor

ndeloof commented Mar 19, 2021

You should rely on profile to group services by usage scenario, so that you can easily enable/disable those

@ulyssessouza
Copy link
Collaborator

As @ndeloof just mentioned, profiles is the way to go. Documentation can be found here

@felipekunzler
Copy link

Sorry, but I believe profiles (e.g. test, debug) has a different use case than what was described in the thread.

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 :)

What do you recommend? A different profile for each possible exclusion? Not sure if that makes sense.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 7, 2021

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)

This indeed is a pretty common scenario, and most users enable remote debugger port in their service definition to cover this need, so they don't have to tweak the compose file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests