Improve container/image name detection
Problem: `setup.sh` fails, if more than one container uses `CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]` Current container/image name detection: List all containers, grep for "supervisor". New approach: List container, with label `org.label-schema.name="docker-mailserver"`
This commit is contained in:
parent
6abcc8ce5f
commit
8c7597f546
9
setup.sh
9
setup.sh
|
@ -25,13 +25,10 @@ if [ -z "$CRI" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INFO=$($CRI ps \
|
INFO=$($CRI ps --no-trunc --format "{{.Image}};{{.Names}}" --filter label=org.label-schema.name="docker-mailserver")
|
||||||
--no-trunc \
|
|
||||||
--format="{{.Image}} {{.Names}} {{.Command}}" | \
|
|
||||||
grep "supervisord -c /etc/supervisor/supervisord.conf")
|
|
||||||
|
|
||||||
IMAGE_NAME=$(echo $INFO | awk '{print $1}')
|
IMAGE_NAME=${INFO%;*}
|
||||||
CONTAINER_NAME=$(echo $INFO | awk '{print $2}')
|
CONTAINER_NAME=${INFO#*;}
|
||||||
DEFAULT_CONFIG_PATH="$(pwd)/config"
|
DEFAULT_CONFIG_PATH="$(pwd)/config"
|
||||||
USE_CONTAINER=false
|
USE_CONTAINER=false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue