Docker Community Forums

Share and learn in the Docker community.

Docker data volume vs data volume container

docker

(Aphecetche) #1

If I understand correctly where things are going, the data volumes (created with e.g. “docker create volume --name vc_xxx”) should be preferred over the data-only volume containers. Correct me if I’m wrong on this, of course :wink:

If that’s the case, then I think some usages have to change… For instance, I used to have a small bash function to remove the dangling volumes :

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

but (again, if I get it straight) by definition the data volume are dangling, aren’t they ?

Then the above function becomes quite dangerous …

So I guess the question would be if there’s a way to “protect” somehow the data volume from unwanted deletion…

Thanks,


(Vrms) #2

Would be interested to understand whether that is actually TRUE. Thinking out loud I’d say …

one thing where a data volume might have an advantage over a data container is size. If I am no mistaken a containers size is limited to 10?GB. So in case you have more then 1 Volume you gain space by using separate data volumes I guess.