:-'Generic Commit'
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 2m40s

This commit is contained in:
Your Name
2025-05-28 20:40:24 +12:00
parent c836b26657
commit f7294e01e4
6 changed files with 75 additions and 65 deletions

View File

@ -41,18 +41,18 @@ _create_and_start_container() {
local run_cmd="$1"
local container_name="$2"
if _is_container_exists $container_name; then
_is_container_running $container_name && return 0
_start_container $container_name
if _is_container_exists "$container_name"; then
_is_container_running "$container_name" && return 0
_start_container "$container_name"
else
$run_cmd
fi
if ! _is_container_running $container_name; then
if ! _is_container_running "$container_name"; then
_die "Container ${container_name} failed to start"
fi
ID=$(_get_container_id $container_name)
ID=$(_get_container_id "$container_name")
echo "Container ${container_name} is running with ID ${ID}"
}
@ -119,32 +119,32 @@ _get_container_status() {
# Starts an existing, stopped container.
_start_container() {
_is_container_exists $1 || return 1
_is_container_running $1 && return 0
docker start $1
_is_container_exists "$1" || return 1
_is_container_running "$1" && return 0
docker start "$1"
}
# Stops a running container.
_stop_container() {
_is_container_running $1 || return 0;
docker stop $1
_is_container_running "$1" || return 0;
docker stop "$1"
}
# Stops (if needed) and removes a container.
_remove_container() {
_stop_container $1
_is_container_exists $1 || return 0;
docker rm $1
_stop_container "$1"
_is_container_exists "$1" || return 0;
docker rm "$1"
}
# Prints the logs for a container.
_get_container_logs() {
if ! _is_container_exists $1; then
if ! _is_container_exists "$1"; then
echo "Container $1 does not exist"
return 1
fi
docker logs $1
docker logs "$1"
}
# Checks if listed environment variables are set; calls _die() if any are missing.