How to check if the docker engine and a docker container are running?

前端 未结 17 1456
既然无缘
既然无缘 2021-01-30 05:03

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

17条回答
  •  自闭症患者
    2021-01-30 05:18

    You can also check if a particular docker container is running or not using following command:

    docker inspect postgres | grep "Running"
    

    This command will check if for example my postgres container is running or not and will return output as "Running": true

    Hope this helps.

提交回复
热议问题