Reputation: 24679
I have the following command:
docker run --privileged=true -it --rm \
-w /usr/src/app \
-v ./package.json:/usr/src/app/package.json \
-v .bowerrc:/usr/src/app/.bowerrc \
-v ./bower.json:/usr/src/app/bower.json \
-v ./build/npm.tmp/node_modules:/usr/src/app/build/npm.tmp/node_modules \
-v ./build/npm.tmp/bignibou-client/src/bower_components:/usr/src/app/build/npm.tmp/bignibou-client/src/bower_components \
digitallyseamless/nodejs-bower-grunt bash
I end up with package.json
being a directory in the docker container instead of a file.
root@c706711a7ad4:/usr/src/app# cat package.json/
cat: package.json/: Is a directory
How can I sort this problem? What am I getting wrong with the syntax?
edit:
Using the advice from @manojlds works fine:
Changing to -v $(pwd)/package.json:/usr/src/app/package.json \
sorts out the issue.
Upvotes: 2
Views: 206
Reputation: 9268
It looks like the Dockerfile in the digitallyseamless/nodejs-bower-grunt
repo already does most of what you're trying to do:
WORKDIR /usr/src/app
- Set the workspaceONBUILD COPY package.json /usr/src/app/
- Copy the package.json
file into the container.ONBUILD COPY bower.json .bowerrc* /usr/src/app/
- Copy the bower.json
into the container.ONBUILD RUN bower install
- Install bowerIf you are lucky, you might be able to just do $ docker run -it --rm digitallyseamless/nodejs-bower-grunt
, (or $ docker run -it --rm digitallyseamless/nodejs-bower-grunt bower
for bower), and it will work.
Upvotes: 1
Reputation: 301177
Try providing an absolute path, instead of a relative path:
-v /home/projects/package.json:/user/src/app/package.json
Upvotes: 1