The reference to the docker compose file does not include any reference to such a thing.
Though, Swarm services are able to use template placeholder in some of the configuration elements to individualize each replica.
You might assign {{.Task.Slot}} to an env and use it in your entrypoint script to add the task slot on top of your base port.