# For example, run "npm install" | |
docker run -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm install | |
# This command creates a container (downloading one first if you don't have it locally), runs the command in a current directory and quits the container | |
# Great Success! |
This comment has been minimized.
This comment has been minimized.
Thanks!! |
This comment has been minimized.
This comment has been minimized.
Thanks very much. Based on this I created a build command, using current node container (alpine, because it is smaller) and chaining two npm commands together:
|
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
With the latest LTS version: |
This comment has been minimized.
This comment has been minimized.
for docker in windows
|
This comment has been minimized.
This comment has been minimized.
For Windows (CMD) docker run --rm -v "%cd%":/app -w /app node:alpine npm i |
This comment has been minimized.
This comment has been minimized.
On MacOS/Linux with NodeJS 10 LTS: docker run --user $(id -u):$(id -g) -v $PWD:/app -v $PWD/.npm:/.npm -v $PWD/.config:/.config -w /app node:10.12.0-alpine npm install |
This comment has been minimized.
This comment has been minimized.
Nice work |
This comment has been minimized.
This comment has been minimized.
Why not create a file named 'npm' in '/usr/local/bin' with:
then now you can use |
This comment has been minimized.
This comment has been minimized.
Hello, I'm new to Docker and lost in your instructions... Thanks for the help ! |
This comment has been minimized.
This comment has been minimized.
@clrmahieu you only have to replace the c:\path_to_app with the full path for your app root folder, usually it's your current path where you have your package.json file. |
This comment has been minimized.
Nice one!