Make docker_config.sh a little smarter about usage

This commit is contained in:
Colby Gutierrez-Kraybill 2018-08-21 11:46:18 -04:00
parent 9bc3fa9ef8
commit cb4e4832a1

View file

@ -1,5 +1,22 @@
#!/bin/bash
NETWORK_NAME=scratchapi_scratch_network
if [ -z $(docker network ls --filter name=^${NETWORK_NAME}$ --format="{{ .Name }}") ] ; then
docker network create ${NETWORK_NAME} ;
fi
command=$1
shift
arg=$1
shift
case "$command" in
network)
if [ -z $(docker network ls --filter name=^${NETWORK_NAME}$ --format="{{ .Name }}") ] ; then
docker network create ${NETWORK_NAME} ;
fi
;;
*)
echo "usage:"
echo " docker_config.sh <command> <arg>"
echo ""
echo " Currently only performs 'docker_config.sh network create'"
;;
esac