I am using Docker Swarm to simulate a lot of client applications in a scale test environment. I create a service and then scale it to however many instances of the client I need. Works great! But I have a problem with the list of connected servers on the host app only doing alphabetical sort. I need a way to left pad with 0's the .Task.Slot parameter when I issue my service creation command. I use the .Task.Slot to create a unique hostname for each client by following Docker docs using Golang "templates":
docker service create \
--name myservice \
--replicas 10 \
--hostname="{{.Service.Name}}-{{.Task.Slot}}" \
images:5000/client:client
I'm open to either doing something with the golang "template" or some other option to get Docker to just left-pad the 0's.
Currently I get host names like "myservice-1", "myservice-10". I'd like to have those like "myservice-00001", "myservice-00010". Then they'll sort nicely in the host UI and make it easier to identify missing instances in a test (scale up to 1000's eventually).