-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Added "docker exec" command for a service or all services. #1180
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
Conversation
Example: $ docker-compose execute web echo "Hello World!" Supports --detach for background running Supports running command on all containers with: $ docker-compose execute all echo "Hello World!" Signed-off-by: Onno Steenbergen <onno@steenbe.nl>
|
That sounds awesome, +1 for merging it! |
|
+1 |
|
Thanks for contributing!
|
|
Oh, and:
|
|
Aanan, thanks for your comments and I will integrate them as soon as possible
|
|
Agree that interactive is a little weird. I understand that docker images with SSH are not really the way to go, but if you really want interactivity on multiple machines, something like SSH + clusterssh (or similar projects) are probably the way to go. |
all is now an options (--all) Renamed long_running to long-running so all folders have the same name convention exec is a python reserved word so needed to change docopt_command to allow for reserved words. Signed-off-by: Onno Steenbergen <onno@steenbe.nl>
|
Point 1 & 2 are integrated. It seems that the Jenkins build bot has an error. About the commit itself: Due to the way docopt works my only way to have --all was to write the usage line as Other combinations ( |
|
I think that if there are multiple containers for a service running, Compose should either refuse to run Thinking about it, |
|
I do not agree that The idea is to have a service (or system with --all) in a predictable state, executing a command on a single worker could result in different behaviour. Over time this will lead to an unstable system. The use-case of I agree that there aren't many use cases, but we can't predict the usage of compose. Maybe some user like to have an arbitrary container, which can be solved by a For parsing the output we could add a output folder option. This will create a separate file for every container running in the service/system. |
|
I can believe there are a few good use cases for running an But Compose isn't (yet) a tool for production environments, and so there isn't a strong need for that feature now. What would be useful, right now, is a command for inspecting a running container - an analogue to |
|
Will work on that (need to add support for exec in dockerpty). As soon as that is finished and pulled I will update this pull. |
|
+1 |
|
+1 |
1 similar comment
|
+1 |
|
Closing as #2023 is the direction we're going in - thanks for the PR! |
Example:
Supports --detach for background running
Supports running command on all containers with: