{"push_id":1010347539,"size":1,"distinct_size":1,"ref":"refs/heads/move-rm-to-daemon","head":"1a787f06d9276dd9153fccb6f21d99f0c48593f2","before":"ec4f0884eebf1f7d4b52e21c5da6f227f69b0ddb","commits":[{"sha":"1a787f06d9276dd9153fccb6f21d99f0c48593f2","author":{"email":"14976e959b2860fb06a3c1edbdb1945a4e11b8b5@huawei.com","name":"Zhang Wei"},"message":"Move --rm to daemon side\n\n`--rm` is a client side flag which caused lots of problems:\n1. if client lost connection to daemon, including client crash or be\nkilled, there's no way to clean garbage container.\n2. if docker stop a `--rm` container, this container won't be\nautoremoved.\n3. if docker daemon restart, container is also left over.\n4. bug: `docker run --rm busybox fakecmd` will exit without cleanup.\n\nIn a word, client side `--rm` flag isn't sufficient for garbage\ncollection. Move the `--rm` flag to daemon will be more reasonable.\n\nWhat this commit do is:\n1. implement a `--rm` on daemon side, adding one flag `AutoRemove` into\nHostConfig.\n2. Allow `run --rm -d`, no conflicting `--rm` and `-d` any more,\nauto-remove can work on detach mode.\n3. Allow coexists of `--rm` and `--restart`, auto remove can work based on\nrestart policy, container removal happens right after the moment container\nstops and won't restart any more.\n4. `docker restart` a `--rm` container will succeed, the container won't\nbe autoremoved.\n5. Daemon restart will cause container to be removed/kept based on\nrestart policy, no matter shut down gracefully or using triple CTRL+C.\n\nThis commit will help a lot for daemon to do garbage collection for\ntemporary containers.\n\nSigned-off-by: Zhang Wei <zhangwei555@huawei.com>","distinct":true,"url":"https://api.github.com/repos/WeiZhang555/docker/commits/1a787f06d9276dd9153fccb6f21d99f0c48593f2"}]}