skill-assessment-app/start-docker.sh

23 lines
495 B
Bash
Raw Normal View History

2016-07-26 10:38:00 -05:00
#!/bin/bash
2016-07-27 15:09:59 -05:00
IMAGE=markamoser/deb-mysql-rails
2016-07-26 10:38:00 -05:00
CONTAINER=`basename ${PWD}`
2016-07-27 15:09:59 -05:00
# if [ "$(docker images -q $IMAGE:latest 2> /dev/null)" == "" ]; then
# docker build -t $IMAGE .
# fi
2016-07-26 10:38:00 -05:00
STATUS=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
if [ $? -eq 1 ]; then
2016-07-26 13:50:35 -05:00
docker run --name $CONTAINER -it -p 3000:3000 -p 35729:35729 -p 3306:3306 -v ${PWD}:/usr/app $IMAGE /bin/bash
2016-07-26 10:38:00 -05:00
exit
fi
if [ "$STATUS"=="false" ]; then
docker start $CONTAINER
fi
docker attach $CONTAINER
2016-07-27 15:09:59 -05:00