How can I check if the services of `docker-compose up` started successfully?

Context: I'm adding CI to my project and as part of it, I'd like to have my CI build the docker image and execute a `docker-compose` command to see if all the services can be brought up successfully before moving on to the next phase of the CI.

I'm thinking that I should do something to the effect of:

```

$ docker build -t myimage .
$ docker-compose up -d

# attempt count the images with a state of "Exit" and if it's more than 1, return 1
# what happens if an image name contains the substring "Exit" but is running healthily?
$ if [[ $(docker-compose -f docker-compose-local.yml ps | grep "Exit" | wc -l) -ne 0 ]]; then return 1; fi

```

I suspect that looking for the state of the container through the `ps` subcommand isn't great and that there's a better solution. I've looked but haven't found one.

What are the possible states of a docker container? The [docker docks](https://docs.docker.com/engine/api/v1.36/#operation/ContainerList) don't mention the possible states.