You can define a health check in the dockerfile. This is also possible in docker-compose and running docker container via cli.
HEALTHCHECK <options> CMD <your command with args> || exit 1
That will provoke that when you do docker ps you'll see if a container is running or stopped, and in case it's running, if it's healthy or not, i.e, if your command is being executed / has been executed properly.