我可以在docker run命令中挂载卷的子目录吗 [英] can I mount subdir of volume in docker run command
本文介绍了我可以在docker run命令中挂载卷的子目录吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试使用docker时,我试图避免缓慢的 osxfs
。因此,我正在运行docker-sync卷容器。
I'm trying to avoid slow osxfs
when using docker. So I'm running docker-sync volume container.
我只想将此卷的子目录安装到另一个容器中。
I want to mount only subdir of this volume to another container.
当前示例错误出:
docker: Error response from daemon: create docker-sync/www/marcopolo.front: "docker-sync/www/marcopolo.front" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed.
See 'docker run --help'.
推荐答案
如您所见,docker当前不提供一种从命名卷内部仅装载子目录的方法。您必须先装载到整个卷,然后选择特定的文件,或者可以在单独的位置装载到卷,并在图像中包括指向特定子目录的符号链接。
As you've seen, docker does not currently provide a way to mount only a sub directory from inside of a named volume. You'll have to mount to entire volume and then either pick your specific files, or you can mount to volume in a separate location and include a symbolic link to your specific subdirectory as part of the image.
这篇关于我可以在docker run命令中挂载卷的子目录吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文