Add check if container is running
This commit is contained in:
parent
6256422ac5
commit
4c504b03aa
2 changed files with 9 additions and 0 deletions
|
@ -3,3 +3,7 @@
|
|||
function getValueByKey() {
|
||||
jq -r ".$1" "${CONFIG}"
|
||||
}
|
||||
|
||||
function getLocalConfValue() {
|
||||
jq -r ".$2" "$1/config.json"
|
||||
}
|
||||
|
|
|
@ -43,6 +43,11 @@ function startpod() {
|
|||
podman network create "$network"
|
||||
fi
|
||||
|
||||
if [[ -n $(podman container ls | grep $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name)) ]]; then
|
||||
log e "Container $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name) is already running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
podman-compose up -d
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue