can I mount subdir of volume in docker run command

折月煮酒 提交于 2019-12-09 03:51:37

问题


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.

Current example errors out:

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'.

回答1:


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.



来源:https://stackoverflow.com/questions/41729237/can-i-mount-subdir-of-volume-in-docker-run-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!