Last active
November 14, 2016 12:28
-
-
Save Eruant/11e37f3605ab5fa8c5dc99f261133d5b to your computer and use it in GitHub Desktop.
Run node with docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `node` run node 6 | |
# `node 3000:8080` run node 6 exposing port 8080 to docker:3000 | |
function node { | |
if [[ -n "$1" ]]; then | |
docker run -i \ | |
-v $(pwd):/app \ | |
-v $HOME/.ssh:/root/.ssh \ | |
-w='/app' \ | |
-p $1 \ | |
-t node:6 bash | |
else | |
docker run -i \ | |
-v $(pwd):/app \ | |
-v $HOME/.ssh:/root/.ssh \ | |
-w='/app' \ | |
-t node:6 bash | |
fi | |
} | |
# `node-latest` run node 6 | |
# `node-latest 3000:8080` run node 6 exposing port 8080 to docker:3000 | |
function node-latest { | |
if [[ -n "$1" ]]; then | |
docker run -i \ | |
-v $(pwd):/app \ | |
-v $HOME/.ssh:/root/.ssh \ | |
-w='/app' \ | |
-p $1 \ | |
-t node:latest bash | |
else | |
docker run -i \ | |
-v $(pwd):/app \ | |
-v $HOME/.ssh:/root/.ssh \ | |
-w='/app' \ | |
-t node:latest bash | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment