-
Notifications
You must be signed in to change notification settings - Fork 5.7k
implement exec #2023
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
implement exec #2023
Conversation
9242ff2 to
ac270d7
Compare
compose/service.py
Outdated
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.
Instead of the filter use stopped=False (which is the default).
|
I think there is still an issue with
So I'm not exactly sure how |
|
The reason I started working on this is
I agree that |
|
@dnephin any update? |
|
@aanand @bfirsh @dnephin once again, any update? Just FYI, k8s support |
|
I agree that the UX for doing an There was another PR/proposal for an This particular implementation looks like a good start, but I think it absolutely needs to support interactivity (via Thoughts? |
|
The equivalent of that k8s exec command is the standard |
Absolutely. I was just waiting for you guys to get some feedback that this is the feature you would be interested in. I'm planning to propose a patch to
Looks like that container argument is optional, snippet from docs: |
ac270d7 to
6f2c9d7
Compare
|
rebased and rewritten (added interactive support with updated dockerpty) |
|
Looks like a test is failing, not sure if it's related |
|
@thaJeztah tests are untouched, am waiting for design review first |
compose/cli/main.py
Outdated
| -d Detached mode: Run command in the background. | ||
| --privileged Give extended privileges to the process. | ||
| --user USER Run the command as this user. | ||
| -T Disable pseudo-tty allocation. By default `docker-compose run` |
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.
s/run/exec/
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.
fixed (well spotted)
6f2c9d7 to
033404f
Compare
|
rebased, updated |
|
those test failures seem unrelated to this PR |
|
I'm really bad at copy-pasting. I'm sorry about that. Should be fixed now. To be honest, I'm unsure how that signal handing should suppose to work. When I ran compose like this docker-compose exec asd shand then hit |
7ad93ad to
10ae099
Compare
|
rebased b/c of the ^ unrelated test failure |
|
LGTM |
Resolves docker#593 Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
10ae099 to
d28c5dd
Compare
|
rebased |
|
\o/ This was a ride! |
|
👌 |
|
Will this also have |
|
@darkn3rd no, it's a cli command; feel free to open an issue with the feature request |
|
@darkn3rd perhaps having an entrypoint script would be a solution for that? I think the "exec" would be executed after the image's main |
|
@thaJeztah to be honest I totally understand @darkn3rd's proposal: I've run into a similar issue: I have a web app with database started by compose. As soon as it's up, I want to populate database with some initial data and am not very keen on doing: Would be awesome if compose had support for hooks. |
|
@TomasTomecek well, the regular approach is to have the entrypoint script take care of that, for example, see the Initializing a fresh instance section for the MySQL image (and the script itself) Overall, |
|
It would be even better to do it as part of |
|
@dnephin yeah, problem is that the official images declare a |
|
@thaJeztah to me, custom entrypoint scripts are pure hack: initializing a service and running a service are two completely different operations which shouldn't be mixed in a single script -- when there is something wrong with such script, you need to debug it in order to have the service running in some form; on top of that, it's not clear what such script does (since usually it's several hundreds of LoC of cryptic shell code). I like the idea with utility container, since it's clearly separates spinning database from its initialization. @dnephin my issue with baking data inside database during build is that you need to run the database during build -- usually that's not a trivial thing. Not even saying that you have an image which can be only used within only one application in a single type of environment (dev/stage/prod). |
|
Hey all, great work getting this merged, hope I'm not hijacking...was looking to use this exact functionality using I see it in the docs now here: https://docs.docker.com/compose/reference/exec/ However, I get an error after running and don't see exec in the command list on the cli.
I did an upgrade using |
|
@mccrodp did you download the latest version of docker toolbox, or performed |
|
@thaJeztah ooops, you were dead right! I had only ran the upgrade from the command line rather than the whole toolbox app (I was still on 1.6.2). Thanks for your help. All working now with |

Resolves #593
Still wip
docker exec -tiequiv)