1.

What is Docker volume mounting?

Answer»

Data is not persistent inside a container. One of the most used methods is Volume mounting.  Another method for persisting data is to include data in the writable layer but that layer is tightly coupled with the host machine where the container is RUNNING, thus the data couldn’t be managed easily. Also writing into the writable layer is complex and needs to use a driver. 

To retain data, the best-preferred way is to use a Docker volume mount where it mounts another directory into your container. This directory is on the host which could be SEEN within the container. The main advantage of volume mounting is

  • Easy to MANAGE using Docker CLI commands.
  • We have support for both Windows and Linux systems
  • Multiple containers can share the VOLUMES.
  • Volumes are easier to back up
  • Volume drivers are present to encrypt volume contents and to store on cloud systems etc
  • The container can pre-populate the NEW volumes with its contents
  • Volumes don't increase the size of the containers.

Following commands could be used to manage volumes:

  • docker volume create <name> to create the volume
  • docker volume ls to list the volumes available to you
  • docker volume inspect <name> to get more details about the volume like path, drivers etc.
  • docker volume rm <name> to remove the container.
  • docker volume prune to remove unused volumes


Discussion

No Comment Found