Docker Bind Mount 与 Volume

 

As a docker in preventing loss of serialized data, docker using a mounted volume way

docker -v volumeName:containerPath 
或者
docker -v containerPath

In this manner, linux in, Docker generated at / var / lib / docker / volumes volumeName directory, the directory is mounted containerPath / var / lib / docker / volumes / $ volumeName / _data Lane

If you do not specify volumeName, will generate a random file

This way is the  Volume .

 

Meanwhile, in order to customize the location of the file exists, or may also be an absolute path ~ / path through the docker -v: containerPath manner, the specified position

In this way, it is known as the  bind mount

 

volumeName View mode volume mount information by docker volume inspect

You can also docker inspect $ name | grep Mounts -A 10 to view information, both ways are supported

 

There should be noted that:

bind mount

  Container to the host folder prevail

volume

  When the host data to the host subject

  No host data, copied over from the container, and then to subject the host

 

Guess you like

Origin www.cnblogs.com/jaxlove-it/p/12097206.html