2024-05-24 12:01:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2019-10-04 17:51:07 +02:00
|
|
|
|
|
|
|
stop() {
|
|
|
|
if status ; then
|
2021-02-17 01:38:02 +01:00
|
|
|
docker stop "$NAME"
|
2019-10-04 17:51:07 +02:00
|
|
|
echo "$NAME stopped"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
status() {
|
2021-02-17 01:38:02 +01:00
|
|
|
if docker ps --format '{{.Names}}' | grep -q "^${NAME}$" ; then
|
2019-10-04 17:51:07 +02:00
|
|
|
echo "$NAME running"
|
|
|
|
else
|
|
|
|
echo "$NAME not running"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
docker_ip() {
|
2021-02-17 01:38:02 +01:00
|
|
|
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{"\n"}}{{end}}' "$NAME" | head -1
|
2019-10-04 17:51:07 +02:00
|
|
|
}
|