Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,22 @@ elif [ "$1" = "exec" ]; then
last_cont_id=$(tail -1 $PWD/.last_exec_cont_id.txt)
docker start ${last_cont_id}
docker exec -ti ${last_cont_id} $RUN_SHELL
elif [ "$1" = "kill" ]; then
containers=$(docker ps -f "ancestor=$DOCKER_TAG" -q)
if [ -z $containers ]; then
echo "No $DOCKER_TAG container has found!"
else
echo "Killing ${#containers[@]} containers of $DOCKER_TAG"
docker kill $containers
fi
else
echo ""
echo "============= $0 [Usages] ============"
echo "1) $0 build : build docker image"
echo " build --no-cache : Build docker image without cache"
echo "2) $0 run : launch a new docker container"
echo "3) $0 exec : execute last container launched"
echo "4) $0 kill : Kill all containers tagged as $DOCKER_TAG"
fi