Skip to content

Instantly share code, notes, and snippets.

@dinigo
Last active August 4, 2016 11:54
Show Gist options
  • Save dinigo/4bef023323ea50aa6b9fb24db0cc9c9a to your computer and use it in GitHub Desktop.
Save dinigo/4bef023323ea50aa6b9fb24db0cc9c9a to your computer and use it in GitHub Desktop.
Build a docker image, spinn it and connect to an inside prompt.
#!/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
@dinigo
Copy link
Author

dinigo commented Aug 4, 2016

Updated undefined $CONTAINER_ID --> $USER/$CONTAINER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment