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

Proposal: Add --up option to run #2490

Closed
dnephin opened this issue Dec 2, 2015 · 7 comments
Closed

Proposal: Add --up option to run #2490

dnephin opened this issue Dec 2, 2015 · 7 comments

Comments

@dnephin
Copy link

dnephin commented Dec 2, 2015

From #2477

If we remove links for networking, run will no longer start any "dependent" services. Some users were depending on this functionality to be able to do things with a single run command.

From #2474

When we changed the default behaviour of up to not exit until all containers have exited, it broke the workflow for some users.

To support these kinds of workflows, we might be able to do something like this:

Add an --up flag to run. This flag would tell Compose to start all services in the project before running the one-off container.

Combined with proposed docker-compose down (#2277) this would allow users to run a testing workflow with only two commands, instead of 4 or 5.

@aanand
Copy link

aanand commented Dec 4, 2015

Interesting idea. It's a shame that we no longer know from looking at the file what services a run depends on, but I imagine that in most cases starting all of them will be acceptable.

@simonvanderveldt
Copy link

Just wanted to create an issue to discuss this, so thx for creating it :)

This basically addresses a big part of what we're missing on CI since 1.5.0 as discussed in #1754. Right now when working with the new Docker networking combined with Compose we need to have 2 docker-compose.*.yml files. 1 to start the dependencies and the other to actually run the application/tests. If we put it in 1 file we can't do up since there's no way to exclude services and run doesn't start dependencies.
Then we also need to stop everything afterwards.

I'd like to add that it would be nice if this could be combined with the changes in #2130 for up to have Compose stop all services if the run command exits.

@aanand Is there nothing planned to track dependencies? Or will that happen in the libcompose based Compose?

@dnephin
Copy link
Author

dnephin commented Jan 19, 2016

@simonvanderveldt see #2682 for discussion, however, I think this proposal is really just a shortcut. It's not new functionality. You can do the same thing today with:

docker-compose -f file1.yaml -f file2.yaml up -d
docker-compose run ...
docker-compose -f file1.yaml -f file2.yaml stop

@simonvanderveldt
Copy link

@dnephin Seems like this has been adressed with depends_on which now correctly works with docker-compose run.

The only thing I think is missing is the --abort-on-container-exit option as added in #2130 for docker-compose run. I'm not really sure why in #2130 --abort-on-container-exit was added to up instead of run though.
Shall I create a new issue to track this?

@dnephin
Copy link
Author

dnephin commented Feb 29, 2016

--abort-on-container-exit belongs on up. run will always exit when the container exits.

We could close this issue, but I wouldn't mind keeping it open for a bit to see if there is any interest in it over time.

@simonvanderveldt
Copy link

--abort-on-container-exit belongs on up. run will always exit when the container exits.

I guess we're talking about different things? I'll try to explain what I mean, if anything is unclear or if I'm not making sense just let me know.

With run supporting depends_on we can now run a one off command for a service which will start all necessary dependencies, run the command and exit.
But once it exits we're left with the dependencies still running.

The initial argument to up for #2130 was --cascade-stop, which I interpret as stop all other services that have been started. Exactly this is what's missing with run.

This might be related to #2774 if that includes dependencies, but that's about the removal of containers not about stopping them.

@dnephin
Copy link
Author

dnephin commented Feb 29, 2016

I think there is very little need for that because run exits, so you can always call stop or down after it exits. It's only needed on up because up wont exit in the default case until all services have exited.

I actually prefer when each command does just one thing and putting them together with some scripting, instead of having a command do multiple things. I guess that's an argument against adding run --up, so I'll close this issue.

@dnephin dnephin closed this as completed Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants