How to ensure dependencies on host are removed when we remove a docker container -


i created docker container , have application running inside it. created second docker container (on same host) same application running inside it. need create few more containers way. however, when remove container, need ensure dependencies creates on host removed. how achieved ?

thanks,

checkout documentation of docker rm command:

usage: docker rm [options] container [container...]

remove 1 or more containers

options:
-f, --force force removal of running container (uses sigkill) --help print usage
-l, --link remove specified link
-v, --volumes remove volumes associated container

so use "-v" option


update

you can use command cleanup volumes no associated containers.

docker volume rm $(docker volume ls -qf dangling=true) 

credit: sceada


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -