In a script, I need to check:
a) Is the docker engine running?
b) Given a container name, is that docker container running?
[the initial wording of this
you can check docker state using: systemctl is-active docker
➜ ~ systemctl is-active docker
active
you can use it as:
➜ ~ if [ "$(systemctl is-active docker)" = "active" ]; then echo "is alive :)" ; fi
is alive :)
➜ ~ sudo systemctl stop docker
➜ ~ if [ "$(systemctl is-active docker)" = "active" ]; then echo "is alive :)" ; fi
* empty response *