Problem with premature state "running" on service

Hi,
I have built some docker container, which allows to create swarm php-workers for any php project, but I have one strange issue. When I update service by command

docker service update php-worker --image logvik/php-worker-git-deploy:latest --reserve-memory 200m --force

I receive some unmanaged gap by time between new worker will be deployed and old will be working.
If doesn’t look into code, by common words, - docker service set state for new container as “running”, but code in entrypoint is not completed and I received 500 errors for some period ~ 30 sec on pull from repo. I just can’t find the reason why docker service set as “running” before deployment will be fully ended…

I have debuged several time and got the one view point - it is not possible to realize on current development state. Docker will set “running” state before any internal process will be completed, because by other way all internal process can’t be being ran in total… Due to this circumstance we can’t use the swarm manager as an endpoint to scale deploymentable container.

I have found several possibilities, but don’t know will be it is worked or not:

--health-cmd (Command to run to check health)
--update-monitor (Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s))

–update-monitor has to allow wait some moment to delay for internal tasks after “running”. For example, we can set 2 minutes for a deployment from repository.