Removing Stopped Containers Automatically


--rm flag

--rm flag automatically removes the container when it exits. and this of course can be very useful so that you don't manually have to clean up all these stopped containers from time to time. Instead, you can simply add this to the run command to ensure that whenever this container is stopped, it's removed automatically.

docker run -p 3030:80 -d --rm 2ddf2ede;

where 2ddf2ede is the image id.