Running one off commands in swarm containers

The closest hack I have found thus far is this, https://gist.github.com/alexellis/e11321b8fbfc595c208ea3e74bf5e54b

In my case, my one-off task is scheduled to run from crond regularly and it needs a whole load of configs from docker swarm, so I wrote a docker-compose.yml but explicitly specify restart condition as none.

Say, the service name is my_service

docker service ls --filter name=my_service --format "{{.ID}}" | xargs --no-run-if-empty -I{} docker service rm {}
docker stack deploy --with-registry-auth -c docker-compose.yml my_service