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
479 - add -rm support to docker run #1589
479 - add -rm support to docker run #1589
Conversation
Not sure why you call |
@vieux I recall I've tried that and it was attempting to remove the container right away. I will check it out again and provide feedback or update the code. |
@unclejack Why did you decide to place this flag in |
@vieux the reason the wait is needed is because run is kept alive by reading from the stdout pipe until it closes (which happens when the program ends). |
ping @unclejack |
@vieux It should be ready now. Please take a look. |
@vieux Please take a look at this PR. It should be OK now. |
There is a race between the container destroy and the wait from CmdRun, try to run
|
@vieux I'm not sure what should be done to fix this in a way that still lets
I've asked for feedback on this issue in #docker-dev, but no conclusion was reached. I don't know how to proceed to fix these issues because I don't know what would be the preferred fix for this issue. |
@creack Just fixed the issue with the race in master by not using Wait but inspecting the container's state. Could you look at that and see if it solves your problem? |
@crosbymichael After having rebased on master, everything seems to be working fine. However, the test for removing containers isn't passing. I'm looking into that now. |
awesome! |
@unclejack see #1948 and |
@vieux @crosbymichael This should be ready. The AutoRemove test should be OK now. There was another test which was failing, but it's also failing on master, so I don't think the failure is being caused by these changes.
|
LGTM ping @creack @crosbymichael |
Please make the commit more concise by squashing and writing a detailed summary of the changes. |
add AutoRemove to HostConfig add -rm flag to docker run add TestRunAutoRemove to test -rm docs: add -rm to commandline/command/run add hostConfig to container monitor make monitor destroy the container via -rm This adds support for automatically removing a container after it exits. The removal of the container is handled on the server side.
@keeb It's done. |
QA Review: LGTM |
LGTM |
Add -rm to docker run for removing a container on exit
Not sure if this is the right place to report this, but: ubuntu@staging-andrei ~ $ sudo docker run -rm ubuntu /bin/date So -rm flag doesn't work with any command. ubuntu@staging-andrei ~ $ sudo docker version |
I'll be fixed by #2385 |
This PR adds support for automatically removing the container when the container exits (or a signal to stop is received). This PR fixes #479.
It's currently supported only when -d isn't provided. It doesn't make sense to automatically remove a container created via
docker run -d
. There are two reasons why this is implemented this way: 1) we might want to retrieve some kind of exit status or logs before removing the container 2) making this run on the server side is difficult in the current architecture.Please feel free to provide feedback for this PR.