Docker Swarm HealthCheck

Hi All!
I have been created script which pushed from host to swarm my compose file.

#!/bin/sh
echo "Enter your compose file : "
read name
echo “Enter master-machine”
read machine

sudo docker-machine scp $name $machine:~
echo “Enter service name:”
read service
sudo docker-machine ssh $machine “docker stack deploy -c $name $service”
This script is for testing. In future it will has more options.
Now I have a question. How can I check that health status of a service?
In example: somebody give me docker-compose file and I will push it to my swarm.
And this means that using the HEALTHCHECK method CMD curl --fail http: // localhost: 9000 / guid / || exit 1 I can not. Since I do not know what services will be there and on which ports
Thanks for help!