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