skill-assessment-app/start-docker.sh
2016-08-12 00:24:15 -05:00

19 lines
420 B
Bash
Executable File

#!/bin/bash
IMAGE=markamoser/rails-dev-mysql:latest
CONTAINER=`basename ${PWD}`
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 -v ${PWD}:/usr/app $IMAGE /bin/bash -c "service mysql start; /bin/bash"
exit
fi
if [ "$STATUS"=="false" ]; then
docker start $CONTAINER
fi
docker attach $CONTAINER