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

--rm does not work with -d #6003

Closed
aidanhs opened this issue May 23, 2014 · 13 comments · Fixed by #20848
Closed

--rm does not work with -d #6003

aidanhs opened this issue May 23, 2014 · 13 comments · Fixed by #20848
Milestone

Comments

@aidanhs
Copy link
Contributor

aidanhs commented May 23, 2014

Original PR: #1589
Justification:

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.

I want to be able to do this, so 1 doesn't apply. I don't think it being difficult is a good reason for this restriction if it's actually wanted.

Hence opening this issue.

@unclejack
Copy link
Contributor

This feature has been discussed before and there were multiple reasons why it didn't get added, including technical ones.

This might be added at some point after 1.0, but not before.

@aidanhs
Copy link
Contributor Author

aidanhs commented Jun 2, 2014

Ok, time scale seems fair, but can this be left open with a milestone of "later" or something?

@aidanhs
Copy link
Contributor Author

aidanhs commented Jun 27, 2014

Ping @unclejack ?

It's now after 1.0 - even if this issue remains closed it would be nice to know what the multiple reasons are (so I don't waste my time with a PR if it's just going to get rejected).

@unclejack
Copy link
Contributor

@aidanhs We haven't forgotten about this, it's just that implementing this right now would be quite hacky. I've looked into this myself and the code wouldn't end up looking so pretty.

@jchysk
Copy link

jchysk commented Jul 15, 2014

You should be able to use --rm with -d. I think this should be reopened.

@Bercon
Copy link

Bercon commented Oct 1, 2014

Why is this still closed?

@vaab
Copy link

vaab commented Oct 28, 2014

Please consider re-opening of this issue.

@ahtik
Copy link

ahtik commented Nov 11, 2014

I got "-d with -rm" working at the shell script level.

If anyone is interested then this is what I came up with:

#!/bin/bash
# Start docker without -rm and we'll get it removed after exit.
PID=$(docker run -d "$@")
[ -z "$PID" ] && echo "Container failed to start!" && exit 1 || (docker wait $PID && docker rm $PID)&

@reustle
Copy link

reustle commented Feb 17, 2015

Has anyone come across a more elegant solution to getting around this issue? Is there any new discussion on getting something like this officially supported? Seeing that other instances of this question point here, it would be nice to mention them if so.

@jessfraz
Copy link
Contributor

you should checkout #10545

@Aidenir
Copy link

Aidenir commented Jun 8, 2016

I can't believe this is still not possible. I'm trying to love docker, but it just feels so hacky, like it leaking disk space by never cleaning anything up, or having some weird latest tag convention that makes no sense what so ever.
(comment for venting and subscription)

@podarok
Copy link

podarok commented Aug 16, 2016

@Aidenir
It is not about docker, it is about humans, cooking docker ))))
Blaming software won't help as much as finding a right people to get you help ))))

@vdemeester
Copy link
Member

@Aidenir it was not possible because --rm was implemented client-side and the docker daemon did not have any information about any "auto-removal" thingy. This is fixed with #20848 and will be in 1.13.0.

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

Successfully merging a pull request may close this issue.