Add script to simply restart a container

This commit is contained in:
hygienic-books 2024-08-17 20:12:20 +02:00
parent cf1788bd83
commit 3fe2b1a4bc

7
one_container_restart Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
declare container_name="${1:?}"
if systemctl --quiet is-active docker.service; then
if [[ "$( docker container inspect -f '{{.State.Running}}' "${container_name}" 2> /dev/null )" == "true" ]]; then
docker restart "${container_name}"
fi
fi