locked
Docker volume/directory mounting RRS feed

  • Question

  • Hello,

    I'm trying to mount a directory from the host machine into the docker container.
     
    I've tried to following command to start the container:
    docker run -i -t -v /c/Users/Administrator/Desktop/test/:/c/test --name=test1 windowsservercore:latest cmd.exe 

    The directory C:\Users\Administrator\Desktop\test is existing and there are files in it.
    But after the start of the container the dir C:\test does not appear inside the container.

    I'm using /C/ because I've seen it here: https://docs.docker.com/userguide/dockervolumes/
    docker run -v /c/Users/<path>:/<container path ... (Windows)

    Is this a bug or do I need change something on the folder permissions?


    Thursday, August 20, 2015 11:21 PM

Answers

  • Looks like -v is not yet supported in TP3

    https://msdn.microsoft.com/virtualization/windowscontainers/about/work_in_progress#GeneralfunctionalityAllnon_C__drivesareautomaticallymappedintonewcontainers

    You can try a workaround. Cautious: Its not quite the same as volumes in Docker container.

    Steps:

    1. Go to disk manager and create a vhdx and attach it.

    2. Format the new disk and use it as a volume.

    3. Run the container without any -v option.

    By default all volumes other than "C:" is visible inside the container. Problem is all the containers might access this volume.

    I am sure Windows will fix this in release version if not earlier.

    --Tapan.

    • Proposed as answer by aL3891 Friday, August 21, 2015 7:20 AM
    • Marked as answer by Ben Armstrong [MSFT] Tuesday, August 25, 2015 6:45 AM
    Friday, August 21, 2015 2:39 AM

All replies

  • Looks like -v is not yet supported in TP3

    https://msdn.microsoft.com/virtualization/windowscontainers/about/work_in_progress#GeneralfunctionalityAllnon_C__drivesareautomaticallymappedintonewcontainers

    You can try a workaround. Cautious: Its not quite the same as volumes in Docker container.

    Steps:

    1. Go to disk manager and create a vhdx and attach it.

    2. Format the new disk and use it as a volume.

    3. Run the container without any -v option.

    By default all volumes other than "C:" is visible inside the container. Problem is all the containers might access this volume.

    I am sure Windows will fix this in release version if not earlier.

    --Tapan.

    • Proposed as answer by aL3891 Friday, August 21, 2015 7:20 AM
    • Marked as answer by Ben Armstrong [MSFT] Tuesday, August 25, 2015 6:45 AM
    Friday, August 21, 2015 2:39 AM
  • Thank you. Then I will look forward to the next TP to continue my tests. Thanks also for the workaround but I need separate directories for each container.
    Friday, August 21, 2015 10:35 AM