Docker Community Forums

Share and learn in the Docker community.

Conflicting options: --rm and -d

docker

(Smrt28) #1

Hi,

This is written in the docker run man: “If you choose to run a container in the detached mode, then you cannot use the -rm option.”. Is there a reason for that?

Thx


(Reinhrst) #2

I was wondering exactly the same thing, and http://stackoverflow.com/questions/24764197/how-can-i-run-containers-detached-and-have-them-automatically-removed-when-they gives a hint, as well as https://github.com/docker/docker/issues/10545#issuecomment-73827389 . The technical issue is that the --rm is handled in the client, and a -d means that the client detaches (long) before the container terminates.


(Smrt28) #3

Thanks for reply. I’m implementing a system of masters and workers. Worker holds no data, the only resource it needs is a CPU, the only data written to the storage is a temporal mess. It returns result to the master. So, “-rm -d” would make sense here since restarting would “clear” the messy worker container.