简体   繁体   中英

Docker volume mounts with empty contents with docker-compose

I'm able to mount a directory with specific files to docker-compose'd containers. My Docker which runs on HyperV. But on my team members are unable to mount this directory.

The same docker-compose file is used. The only difference is my docker runs on HyperV and my team members on 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.

Here is a snippet of my 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

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM