I m learning docker and I m having some troubles dealing with volume on a nodejs application.
Actually, I have a simple application that I want to test each time I restart my container.
This way, I have the following dockerfile :
FROM node:4-onbuild
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
CMD [ "npm", "test" ]
Now, I have built the image using :
docker build -t myapp .
And I tried to run it using the followings scripts :
docker run -v //c/Project/nodejs/my-app:/usr/src/app my-app
or
docker run -v /c/Project/nodejs/my-app:/usr/src/app my-app
or even
docker run -v c:/Project/nodejs/my-app:/usr/src/app my-app
I have the following error that tells me that I don't have a package.json file inside of /usr/src/app (but it's where my volume is located, it should be right no ?)
npm info it worked if it ends with ok
npm info using npm@2.15.9
npm info using node@v4.5.0
npm ERR! Linux 4.4.15-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "test"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! path /usr/src/app/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
NB : if I use the COPY command instead of volumes, it works great, and I can see my nodejs tests inside of the docker container
NB2 : I m on windows 10, docker v1.12.0