Docker Volume


before going into docker volume lets clear docker file system first.
The Docker File System
A Docker image is a collection of read-only layers. When we launch a container from an image, Docker adds a read-write layer to the top of that stack of read-only layers. Docker calls this the "Union File System".
Any time a file is changed, Docker makes a copy of the file from the read-only layers up into the top read-write layer. This leaves the original (read-only) file unchanged. 
When a container is deleted, that top read-write layer is lost. This means that any changes made after the container was launched are now gone.
======================================
What is docker volume
A Docker volume keep outside the container, on the host machine.
From the container, the volume use like a folder which we can use to store and retrieve data. It is simply a mount point to a directory on the host.
 ======================================
Create docker volume
Docker volume created by the following ways.
1.Create and Name a Volume
2.mount a specific directory on our host machine as a Docker volume on the container
3.Create a Docker Volume Using a Dockerfile

beside this we can share volume between container,we can use a container as shared data volume,we can mount a volume to container as read only.

 

Comments

Popular posts from this blog