can I mount subdir of volume in docker run command

2020-05-03 10:51发布

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.

enter image description here

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条回答
家丑人穷心不美
2楼-- · 2020-05-03 11:21

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.

查看更多
登录 后发表回答