Docker volume mounts with empty contents with docker-compose

1k Views Asked by At

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/
1

There are 1 best solutions below

0
On

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/