0

I have a docker-compose.yml file. After starting docker services using docker-compose -f {docker-compose.yml path} up -d, I want to check if all the services defined in docker-compose.yml are running.

I can get a count of all running services using docker ps | wc -l. How can I get the count of all services defined in docker-compose.yml?

If I have the count of all services defined in docker-compose.yml, I can compare this number with the number of services running to check if all services are running.

Abhay Gupta
  • 786
  • 12
  • 30
  • `check if all services are running.` This is XY question. See https://stackoverflow.com/a/68526134/9072753 – KamilCuk Aug 31 '21 at 12:47

1 Answers1

2

Count lines from --services output:

docker-compose ps --services | wc -l
KamilCuk
  • 120,984
  • 8
  • 59
  • 111