Add check if network does not exist

This commit is contained in:
LinuxSquare 2023-12-23 13:36:50 +01:00
parent 4c504b03aa
commit 5161cfd213

View file

@ -40,7 +40,9 @@ function startpod() {
# check if network is needed
if [[ -n $(jq -r .network.name "$(getValueByKey 'PODMAN_DIRECTORY')/${1}/config.json") ]]; then
local network="$(jq -r .network.name $(getValueByKey 'PODMAN_DIRECTORY')/${1}/config.json)"
podman network create "$network"
if [[ -z $(podman network ls | grep "$network") ]]; then
podman network create "$network"
fi
fi
if [[ -n $(podman container ls | grep $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name)) ]]; then