29 lines
934 B
Bash
29 lines
934 B
Bash
#!/usr/bin/env bash
|
|
|
|
##
|
|
# description: starts the defined podman container
|
|
# usage: startpod <pod-name>
|
|
##
|
|
function startpod() {
|
|
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
|
|
log e "Podman-directory of ${1} does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
|
|
|
|
# check if network is needed
|
|
if [[ -n $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} network.name) ]]; then
|
|
local network="$(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} network.name)"
|
|
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
|
|
log e "Container $(getLocalConfValue $(getValueByKey 'PODMAN_DIRECTORY')/${1} container.name) is already running"
|
|
exit 1
|
|
fi
|
|
|
|
podman-compose up -d
|
|
}
|