A 'node docker environment' so I don't have to run untrusted code outside a container when developing software
Developing software often requires trying libraries out on your local machine. But you are often running untrusted code which could be doing literally anything. This aims to be a really simple wrapper around docker with no dependencies (other than docker) to run node.js processes.
Features:
- The first
-p PORT
gets included as an environment variable - Gets the node version from your
package.json
- Mounts the local directory and
cd
's to it (with:delegated
, because OSX perf is poor without it)
Install docker and copy nde
to your bin
directory
Install a dependency, code only run inside the container
nde npm install semver
Run a process
nde node hello.js
Bind to a port, note that the container will have an environment variable PORT
defined for the first -p
option defined
nde -p 3000 node server.js
nde -p 3000 node -e "console.log('hello world!')"
Start a sh
shell
nde
Start a node
shell
nde node
Override node version
nde --node 8