Volumes

이동규 (Justin)·2023년 5월 10일
0

Volumes are the preferred mechanism for 'persisting data'
generated by and used by Docker containers.

While bind mounts are dependent on the directory structure and OS of the host machine,

volumes are completely managed by Docker.

Volumes have several advantages over bind mounts.

  • Volumes are 'easier to back up or migrate' than bind mounts.
  • You can manage volumes using Docker CLI commands or the Docker API.
  • Volumes work on both Linux and Windows containers.
  • Volumes can be more safely shared among multiple containers.*
  • Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality. (분리될 수 있군)
  • New volumes can have their content pre-populated by a container.
  • Volumes on Docker Desktop have much higher performance than bind mounts from Mac and Windows hosts. (Docker Desktop의 볼륨이라는건 클라우드에서 제공하는걸 의미하는걸까?)

volumes are often a better choice than persisting data in a container's wriable layer, because a volume doesn't increase the size of the containers using it, and the volume's contents exist outside the lifecycle of a given container.

결론: 볼륨을 사용함으로써 지속가능한 데이터를 컨테이너의 바깥으로 분리시킬 수 있다!

레퍼런스
Volumes - Docker Documentation

Docker Volume - bikramat, medium

profile
Frontend Developer, JamStack, Ethereum

0개의 댓글