If you want/need to get the given Published Port for a given target port in a docker service you can use:
docker service inspect SERVICE_NAME --format='{{range .Endpoint.Ports}}{{if eq .TargetPort 8080}}{{.PublishedPort}}{{end}}{{end}}'
If you want/need to get the given Published Port for a given target port in a docker service you can use:
docker service inspect SERVICE_NAME --format='{{range .Endpoint.Ports}}{{if eq .TargetPort 8080}}{{.PublishedPort}}{{end}}{{end}}'