what’s volume in docker

tags: learning linux docker

content

  • volume is a way to persist and share container data across lifecycles
  • it’s basically a way to store data outside of containers

Example:

  • docker run -v /mnt/data:/data my-image
  • this command run a container from my-image, mounting /data in the container to /mnt/data on the host machine
  • whatever the container writes to /data is written to /mnt/data on host machine

up

drive-volume-partition

down

reference