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