2

I need to run a npm commands via a dockerized npm as:

$ docker run -it -v /C/Users/sam/Documents/Workspace/project:/workspace lynxsolutions/docker-npm-bower-gulp /bin/bash

The image name is: lynxsolutions/docker-npm-bower-gulp

I will have the prompt:

root@892f74a14e2d:/workspace#

however, if I run ls, it will return nothing, so, why the volume mapping is not working?

Mohammad AL-Raoosh
  • 721
  • 1
  • 12
  • 32
  • Does this path exist and contains files in the host machine? You specify docker command with Windows-style path, Is it properly declared? – buddy123 Apr 18 '16 at 10:14
  • Yes,the path is right, and when i try to give him the path in windows-style like this: `C:\Users\sam\Documents\Workspace\project` it give me this error `docker: Error response from daemon: Invalid bind mount spec "C:\\Users\\sam\\Documents\\Workspace\\project:/workspace": volumeinvalidmode: invalid mode: "/workspace"` – Mohammad AL-Raoosh Apr 18 '16 at 10:17
  • But I assume you're using docker machine or virtualbox in some manner to run Docker? – buddy123 Apr 18 '16 at 10:22
  • Yes i use docker toolbox and vm to run my project. – Mohammad AL-Raoosh Apr 18 '16 at 10:24

2 Answers2

2

Try removing capitalization on /C, i.e. use /c.

ateles
  • 422
  • 3
  • 10
-1

You are running docker using Windows, together with tools like Docker toolbox, or simply a VM to manage your docker containers. All your volumes and files you wish to share with your container must reside on the host machine, the one that is actually running the docker daemon, that is, in your case, the VM

Hence, You cannot create a volume with files that resides on your computer, as they aren't accessible from within the host (the VM) You would have to first copy the files to the VM, to some location and then use that location as the host mountpoint

buddy123
  • 5,679
  • 10
  • 47
  • 73
  • But, I need to create a volume, not to copy the files .. I already created volumes using docker-compose , but running the image directly didn't work.. – Mohammad AL-Raoosh Apr 18 '16 at 10:35