From 167b38df769a55dc19e3d78e19013ff66c74b329 Mon Sep 17 00:00:00 2001 From: Erik Wramner Date: Sun, 22 Dec 2019 09:37:58 +0100 Subject: [PATCH] Only use docker inspect with container name #1336 --- setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 6d41e406..8f94135d 100755 --- a/setup.sh +++ b/setup.sh @@ -36,9 +36,11 @@ DEFAULT_CONFIG_PATH="$(pwd)/config" USE_CONTAINER=false _update_config_path() { - VOLUME=$($CRI inspect $CONTAINER_NAME \ - --format="{{range .Mounts}}{{ println .Source .Destination}}{{end}}" | \ - grep "/tmp/docker-mailserver$" 2>/dev/null) + if [ ! -z "$CONTAINER_NAME" ]; then + VOLUME=$(docker inspect $CONTAINER_NAME \ + --format="{{range .Mounts}}{{ println .Source .Destination}}{{end}}" | \ + grep "/tmp/docker-mailserver$" 2>/dev/null) + fi if [ ! -z "$VOLUME" ]; then CONFIG_PATH=$(echo $VOLUME | awk '{print $1}')