Docker Community Forums

Share and learn in the Docker community.

Controlling docker swarm with pre-update scripts

I have a question, and I can’t seem to find it in the docs.
I have 3 instances of freeswitch in docker swarm. When I do an image update, I’d like to run a script first, and only continue when the script exits. This script will do some dns wrangling, then will keep querying the freeswitch instance until #calls is 0. Only when there are zero calls do I want to continue with the update.

How do I do this, or are there docs somewhere on this?
thx

Is this the answer? docker docs
I need to define the entrypoint and have the “stop” part wait until the conditions are met?