-v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro]. If "host-dir" is missing, then docker creates a new volume.
Dockerfile有VOLUME指令
VOLUME ["/data"] - The VOLUME instruction will add one or more new volumes to any container created from the image.
从我看到的,当使用Dockerfile时,没有办法指定host-dir或rw / ro状态。
在docker文件中是否还有其他使用VOLUME,而不是想与其他容器共享?
Dockerfiles旨在便携和共享。主机容量是100%主机依赖的,并且会在任何其他机器上断开,这是Docker想法的一点点。因此,只能在Docker文件中使用便携式指令。如果需要主机目录卷,则需要在运行时指定它。
来自Dockerfile的VOLUME的常见用法是存储配置或网站源,以便稍后可以由另一个容器进行更新。
精彩评论