查看docker 容器状态

有时候需要查看宿主机上的docker服务状态,以及哪些容器在运行或情况如何

查看docker服务状态

systemctl is-active docker

systemctl status docker

systemctl status [service name]命令会持续、实时显示相关服务的状态信息,如果要退出systemctl status状态回到提示符,可以:

Press Q: You can simply press the "Q" key on your keyboard to quit the "systemctl status" display. This will return you to the command line.

Press Ctrl + C: You can also press "Ctrl" and "C" simultaneously to send an interrupt signal to the "systemctl status" command, which will exit it and return you to the command line.

查看运行的容器状态

docker ps

查看所有容器状态

docker ps -a