Merge pull request #1344 from erik-wramner/fix_1336_docker_inspect

Only use docker inspect with container name #1336
This commit is contained in:
Erik Wramner 2019-12-22 10:43:28 +01:00 committed by GitHub
commit f69d30f62a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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}')