DEV Community

Megha Kadur
Megha Kadur

Posted on

#Volumes in #Docker: What Are They?

Containers are temporary, what I mean by temporary is that containers are moved around a lot, they are shuffled a lot, today containers might be on server 1 tomorrow it might be on server 2, or the application itself might be updated. Docker containers are used to run our application. When we delete a container all the data within that container is deleted with it, so containers are not really used to store the data. In such cases if we want to persist our data even if the container is deleted, there comes the use of Volumes.

Where does docker volumes come into play?
Let us understand volume in general, imagine you have a pen drive and you have attached it to your personal laptop, you can access your pen drive from your system(laptop) and if you want to copy any content or paste new content within your pen drive you can do that easily, just like it was a part of your laptop but in reality that pen drive is an external volume to your system(laptop), it’s not a part of the laptop itself. So generally what volume means is an external source of data. In order to save (persist) the data and also share the data between the containers docker uses the concept of Volumes.

Benefits of using Docker Volumes
We can share data with multiple containers.
Persistent
Easier to backup and migrate.

Let me know what you think!

Top comments (0)