In the previous article, we talked about the first way Docker volume will automatically help you map a LUN as a container store on host, and this time we will implement volume in a more violent and intuitive way, as shown in the architecture:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf770.tmp[8] "border=" 0 "alt=" wpsf770.tmp[8] "src=" http://s3.51cto.com/wyfs02/M01/82/D9 /wkiom1dicmqqvjkzaabt0f9durm214.jpg "width=" 549 "height=" 407 "/>
1, first add the next previous article did not mention, is used as volume container can be attached to other container, such as the following example:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf771.tmp[4] "border=" 0 "alt=" wpsf771.tmp[4] "src=" http://s3.51cto.com/wyfs02/M02/82/D8 /wkiol1dic3-xom_baabaiwe1xs8291.jpg "width=" 644 "height="/>
2, then we go into the vmctest02 to see is also mounted/vmctest:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf772.tmp[4] "border=" 0 "alt=" wpsf772.tmp[4] "src=" http://s3.51cto.com/wyfs02/M00/82/D9 /wkiom1dicmus-faoaaaz94q3wkm220.jpg "width=" 335 "height=" "/>"
3, Ok, test complete, now let's look at the second way, we first set up a physical path:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf783.tmp[4] "border=" 0 "alt=" wpsf783.tmp[4] "src=" http://s3.51cto.com/wyfs02/M01/82/D9 /wkiom1dicmyxedifaaa-gymwfpe154.jpg "width=" 592 "height=" "/>"
4, the second way is to use the physical path mapping directly, using the following instructions to mount:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf784.tmp[4] "border=" 0 "alt=" wpsf784.tmp[4] "src=" http://s3.51cto.com/wyfs02/M02/82/D8 /wkiol1dic4lbtki-aaaowhff1ii451.jpg "width=" 568 "height="/>
5. Then we go into the container and look at the same position:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf785.tmp[4] "border=" 0 "alt=" wpsf785.tmp[4] "src=" http://s3.51cto.com/wyfs02/M00/82/D9 /wkiom1dicm3jdyuxaaa3flnu1ps812.jpg "width=" 497 "height="/>
6. We create a folder under the mapping path of the container:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf786.tmp[4] "border=" 0 "alt=" wpsf786.tmp[4] "src=" http://s3.51cto.com/wyfs02/M02/82/D8 /wkiol1dic4pdyakeaaavxmo_ym8686.jpg "width=" 283 "height=" "/>"
7, we see on the host whether to sync to the folder inside the container:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf787.tmp[4] "border=" 0 "alt=" wpsf787.tmp[4] "src=" http://s3.51cto.com/wyfs02/M00/82/D8 /wkiol1dic4tamddtaaa1wqe0nx4233.jpg "width=" 353 "height=" 129 "/>
8. Next, we go into the container again and see if it matches the host.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px; "title=" wpsf788.tmp[4] "border=" 0 "alt=" wpsf788.tmp[4] "src=" http://s3.51cto.com/wyfs02/M01/82/D9 /wkiom1dicndtjllcaaazt5u2rpc688.jpg "width=" 251 "height=" "/>"
9, now to complete the two volume way, summed up:
A, the volume mount created by Dockerfile is actually a mount point created under Dockerhost
B, through-V and mapping the path, a bit like direct-attached storage, directly map the host's volume into the container
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;float:none; Border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto; padding-top:0px, "title=" logo "border=" 0 "alt=" logo "src=" http://s3.51cto.com/wyfs02/M02/82/D9/ Wkiom1dicngyvowsaad36u9dbpk586.png "width=" 541 "height=" 355 "/>
This article from "Vmcloud" blog, declined reprint!
"Vmcloud Cloud Platform" embracing Docker (Fri) Volume (2)