Deep
Deep

Reputation: 3076

Empty directory when mounting volume using windows for docker

I am attempting to mount a volume from C:/Users into a container running on a docker-machine using the hyperv driver on docker for windows (win 10 pro). I am a using the lastest docker (1.13.1) and the same on the hyper vm machine. I have tried switching to using a local account, shared the drive in the docker settings menu and ive pretty much tried everything i could find on google.

Running the test volume run command in the settings menu works for me. At this point in time I presume hyperv does not support mounting volumes from the host however i cant find anywhere that explicitly says that volumes mounting will not work in hyperv.

This is my docker-compose config:

networks: {}
services:
  app:
    build:
      context: C:\users\deep\projects\chat\app
    command: sleep 3600
    image: app
    links:
    - rethinkdb
    - redis
    ports:
    - 4005:4005
    - 4007:4007
    volumes:
    - /c/users/deep/projects/chat/app:/usr/src/app:rw
  redis:
    image: redis
  rethinkdb:
    image: rethinkdb:2.3.5
version: '2.0'
volumes: {}

In my Dockerfile i can see copy files into the container to usr/src/app. When i up the services with the volume specified in the compose file the directory is emptied, however i omit this volume mount i can see my files that i copied into the container from the dockerfile.

Running verbose when starting my services i can see a volumes path specified as such 'Binds': [u'/c/users/deep/projects/chat/app:/usr/src/app:rw']. However, when i inspect the container using docker-compose inspect app i see volumes set to null "Volumes": null.

I presume at this point that mounting volumes into a container running inside a hyperv VM is not supported? Can someone confirm so that I can RIP :)

Upvotes: 2

Views: 4717

Answers (3)

zhrist
zhrist

Reputation: 1558

As stupid as it seems, this happens to me often. The solution is to un-check the C drive in "Docker for windows" - > Setting - > Shared Drives, apply and check it again with apply.

Upvotes: 0

ulu
ulu

Reputation: 6092

You should use /c/Users, with a capital "C".

Upvotes: -1

alebianco
alebianco

Reputation: 2555

I think you just need to share the volume (c:) of the folder from the Docker app settings.

See the "Shared Drives" paragraph from the getting started guide

I'm using mounted folders with a similar configuration and it works fine once the drive has been shared.

Upvotes: 0

Related Questions