[英]Docker volume mounts with empty contents with docker-compose
I'm able to mount a directory with specific files to docker-compose'd containers. 我可以将包含特定文件的目录挂载到docker-compose的容器中。 My Docker which runs on HyperV. 我的在HyperV上运行的Docker。 But on my team members are unable to mount this directory. 但是在我的团队中,成员无法挂载此目录。
The same docker-compose file is used. 使用相同的docker-compose文件。 The only difference is my docker runs on HyperV and my team members on VirtualBox. 唯一的区别是我的docker在HyperV上运行,而我的团队成员在VirtualBox上运行。 So maybe it's this difference that causes the issue? 因此,也许是这种差异导致了问题?
I thought of creating the volume using docker volume create ...
But I couldn't understand how I link it to an existing directory with content. 我曾想过使用docker volume create ...
但是我不明白如何将其链接到具有内容的现有目录。
Here is a snippet of my docker-compose.yml. 这是我的docker-compose.yml的片段。 Any point of direction is appreciated. 任何方向都值得赞赏。
version: '3.2'
services:
service1:
...
volumes:
- type: volume
source: ./volume
target: /opt/volume/
create a docker-compose.yml files 创建一个docker-compose.yml文件
Create a custom path volume and run your application in swarm mode 创建一个自定义路径卷并以群集模式运行您的应用程序
version: '3'
services:
app:
image: app
volumes:
- data-logs:/var/wslogs
volumes:
data-logs:
driver: local
driver_opts:
o: bind
type: none
device: /my/host/path/logs/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.