docker-api icon indicating copy to clipboard operation
docker-api copied to clipboard

How do pass --rm to automatically remove container once it stops?

Open salmanulhaq opened this issue 7 years ago • 4 comments

How do I pass --rm option when creating a container to make sure it automatically gets killed once it stops after CMD execution?

salmanulhaq avatar Feb 12 '19 14:02 salmanulhaq

When creating a container you can set AutoRemove to true in the HostConfig object.

beeman avatar Mar 04 '19 23:03 beeman

Awesome, thanks!

salmanulhaq avatar Mar 05 '19 01:03 salmanulhaq

is there an exhaustive list of config parameters in documentation somewhere? That will be very useful

salmanulhaq avatar Mar 05 '19 01:03 salmanulhaq

I've been using the API docs mostly. This specific flag is not even documented, I found it by searching the output of docker inspect <container>.

beeman avatar Mar 05 '19 02:03 beeman