Last active
August 4, 2016 11:54
-
-
Save dinigo/4bef023323ea50aa6b9fb24db0cc9c9a to your computer and use it in GitHub Desktop.
Build a docker image, spinn it and connect to an inside prompt.
This file contains hidden or 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
#!/bin/bash | |
USER=$(whoami) | |
EXPOSE=3000 | |
CONTAINER=$(basename $(pwd)) | |
[ -d node_modules ] && rm -rf node_modules | |
if grep -q $CONTAINER <<< $(docker ps -a); then | |
echo detiene el contenedor | |
docker stop $CONTAINER | |
echo elimina el contenedor | |
docker rm $CONTAINER | |
echo elimina la imagen | |
docker rmi $USER/$CONTAINER | |
fi | |
docker build -t $USER/$CONTAINER . | |
docker run -p $EXPOSE:$EXPOSE --link mongo:mongo --name $CONTAINER -d $USER/$CONTAINER | |
echo _____________________________________________ | |
docker ps -a | grep $CONTAINER | |
echo $(curl -s ifconfig.io) | |
docker exec -it $CONTAINER bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated undefined
$CONTAINER_ID
-->$USER/$CONTAINER