skill-assessment-app/start-docker.sh
2016-07-26 13:54:04 -05:00

22 lines
475 B
Bash
Executable File

#!/bin/bash
IMAGE=deb-rails-dev
CONTAINER=`basename ${PWD}`
if [ "$(docker images -q $IMAGE:latest 2> /dev/null)" == "" ]; then
docker build -t $IMAGE .
fi
STATUS=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
if [ $? -eq 1 ]; then
docker run --name $CONTAINER -it -p 3000:3000 -p 35729:35729 -p 3306:3306 -v ${PWD}:/usr/app $IMAGE /bin/bash
exit
fi
if [ "$STATUS"=="false" ]; then
docker start $CONTAINER
fi
docker attach $CONTAINER