Make Hubot start with Docker Compose when RocketChat

I am using with docker-compose, additionally I use the hubot.
My problem is, that I always have to manually stop and restart hubot, because it starts to early, can’t get a connection to and then fails without retrying.

I got the idea, that it could be possible to add a line like here for the mongodb, to let hubot check, is rocket chat is ready.

command: bash -c ‘for i in seq 1 30; do node main.js && s=$$? && break || s=$$?; echo “Tried $$i times. Waiting 5 secs…”; sleep 5; done; (exit $$s)’

Does someone know, what this line could be?