First install the latest Docker(I use the Mac version for this tutorial) here: http://docs.docker.com/mac/step_one/
Get Webstorm: https://www.jetbrains.com/webstorm/ Start the Docker Quick start terminal (see screenshot) You’ll start the default docker vm (linux inside OS X).You can find this later by issuing ‘docker-machine ls’:
![]Go and download an image inside the docker terminal:Use ‘docker pull ubuntu’
To run an interactive shell in the Ubuntu image: use ‘docker run -i -t ubuntu /bin/bash’
Of course we also want to mount our home directory: e.g. use ‘docker run -it -v $HOME:/mnt ubuntu’ Inside the docker host you can find out that your mount is there: ‘ls /mnt’
Go and create a folder on the host system that is going to have the app that you want to install for example /Users/thajoust/dev.Create a package.json file by issuing a : ‘npm init’ on the host system in $HOME/dev or create a empty one with: ‘touch $HOME/dev/package.json’ on the host system shell.
Now you will be in the container and you will be able to see the package.son. You can safely delete it now.
Next up is installing node in the container: First update the package state: ‘apt-get update’ then: ‘apt-get install nodejs’
Install npm: ‘apt-get install npm’ ![Screen Shot 2015-09-16 at 14.25.19]
Install Node locally: ‘npm install n -g’
First install wget:‘apt-get install wget’
Install express generator:‘npm install -g express-generator’
Inside your testApp folder you can create an express App:‘express my app’
Now we have to introduce a quick workaround for the problem that on some platforms there will be problems with symlinks,. echo “bin-links=false” »$HOME/.npmrc
There is now a folder with the name my app, let’s continue:‘cd myapp’ followed by ‘npm install’ (will install all the modules required for running your app) Then it is time to start the app:‘npm start’ Now go to webstorm and open the folder my app
You will see all the files.Configure the Run/Debug Configuration:Create a Node.js remote Debug using the + on left side cornerHost: 192.168.99.100 Port: 5858Exit the docker container and commit it:‘exit’‘docker ps -l’ ‘docker commit -m “message” containerId [newNameForTheImage]:[tag]’![docker commit -m “message” containerId [newNameForTheImage]:[tag]](https://docs.google.com/uc?id=0B6Wt_WnMwIKqOF9hNWlpQzZZbmM&export=download)Now we need to be able to open the ports that the node app is listening (both the app and the debugger):‘docker run -it -v $HOME/dev:/testApp -w /testApp/myapp -p 3000:3000 -p 5858:5858 ubuntu:version1’ Run node express app in debug mode:‘node –debug ./bin/www’If you go to Webstorm and run the app with your Debug Configuration you will see that all is working.Below is the breakpoint reached when i set it and go to http://192.168.99.100:3000
