Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Shriharsh
Shriharsh

Posted on • Edited on

     

Today I Learned: About Docker Volume

Docker Volume

In my experiements on running Jenkins on Docker, I wondered how the volumne worked when I provided-v to the run command.

I found a great article which succintly explains a lot about the Docker Volume - which will be handy for any docker beginer.

Original article ishere

My summary goes below:

  • Docker Volume is the way topersist data between container restarts andshare it between containers.
  • A volume is stored on the host file system. Usually within obscure directories inside/var/lib/docker. However, a specific directory on host system can also be mounted as volume in a container.
  • Volumes can be managed usingdocker volume and its sub commands.
  • Docker won't delete volume unless specifically instructed to do so. This can result in stale data on the host system. So tidying up once in a while might come handy.
  • Important Caveat - Don't try to modify the content of the volume in the Dockerfile (via RUN) as each build step creates anew volume and your changes will be discarded. If you want to change the volume content, do so using theENTRYPOINT command in the Dockerfile. Have a look at thislink.
  • If you are looking for a thorough overview of different approaches to manage application data, including the use ofVolume, Bind mounts, tmpfs mounts, read thislonger article

Image Credit:https://docs.docker.com/engine/admin/volumes/images/types-of-mounts-volume.png

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Software Engineer
  • Location
    Bangalore, India
  • Joined

More fromShriharsh

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp