Making docker scripts more robust
This commit is contained in:
parent
efbb720adf
commit
bd24e8ffa0
@ -4,6 +4,6 @@
|
||||
set -x
|
||||
docker compose \
|
||||
-f fab/d/docker-compose.yaml \
|
||||
--project-name ${REPO_NAME} \
|
||||
-p ${REPO_NAME} \
|
||||
--project-directory ${REPO_FOLDER} \
|
||||
down
|
||||
|
||||
@ -26,9 +26,10 @@ if [ "$ALREADY_RUNNING" -eq 0 ];
|
||||
then
|
||||
echo "Service already running, only opening shell"
|
||||
else
|
||||
echo "Service not running, starting service"
|
||||
docker compose \
|
||||
-f fab/d/docker-compose.yaml \
|
||||
--project-name ${REPO_NAME} \
|
||||
-p ${REPO_NAME} \
|
||||
--project-directory ${REPO_FOLDER} \
|
||||
up -d
|
||||
fi
|
||||
@ -36,6 +37,7 @@ fi
|
||||
echo "Connecting to docker shell and running command $COMMAND..."
|
||||
docker compose \
|
||||
-f fab/d/docker-compose.yaml \
|
||||
--project-name ${REPO_NAME} \
|
||||
-p ${REPO_NAME} \
|
||||
--project-directory ${REPO_FOLDER} \
|
||||
exec $REPO_NAME $COMMAND
|
||||
exec $REPO_NAME $COMMAND
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
NETWORK_EXISTS=0
|
||||
#This is necessary instead of using $? (previous command exit code) as we are set -e mode,
|
||||
#which exists the script on any error
|
||||
docker network ls | grep ${PARENT_PROJECT} || NETWORK_EXISTS=1
|
||||
docker network ls | grep " ${PARENT_PROJECT} " || NETWORK_EXISTS=1
|
||||
#0 if already exists, 1 if doesn't exist (0=no error)
|
||||
|
||||
if [ "$NETWORK_EXISTS" -eq 0 ];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user