Skip to content

[docker service ls] should recognize and format published port ranges #178

Description

@jefflill

I have some services that publish lots of ports in a range to the Docker ingress network (this is a reverse proxy). The docker service ls command does not recognize the port range and instead outputs the individual port mappings which looks pretty ugly.

It would be really nice if the CLI could recognize a range and output a syntax like: *:5300-5499->5300-5499

In the example below, the neon-proxy-private service published ports 5300-5499 and the neon-proxy-public service published 5100-5299. You can see the long list of individual ports by scrolling to the right.

root@test-manager-0:~# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
144o4lwwtjkp neon-proxy-private global 3/3 neoncluster/neon-proxy:latest *:5386->5386/tcp,*:5404->5404/tcp,*:5469->5469/tcp,*:5491->5491/tcp,*:5495->5495/tcp,*:5303->5303/tcp,*:5327->5327/tcp,*:5378->5378/tcp,*:5420->5420/tcp,*:5471->5471/tcp,*:5472->5472/tcp,*:5499->5499/tcp,*:5332->5332/tcp,*:5366->5366/tcp,*:5383->5383/tcp,*:5422->5422/tcp,*:5432->5432/tcp,*:5476->5476/tcp,*:5435->5435/tcp,*:5467->5467/tcp,*:5310->5310/tcp,*:5311->5311/tcp,*:5340->5340/tcp,*:5380->5380/tcp,*:5416->5416/tcp,*:5427->5427/tcp,*:5324->5324/tcp,*:5389->5389/tcp,*:5423->5423/tcp,*:5493->5493/tcp,*:5374->5374/tcp,*:5410->5410/tcp,*:5453->5453/tcp,*:5484->5484/tcp,*:5315->5315/tcp,*:5333->5333/tcp,*:5405->5405/tcp,*:5449->5449/tcp,*:5492->5492/tcp,*:5341->5341/tcp,*:5379->5379/tcp,*:5425->5425/tcp,*:5428->5428/tcp,*:5485->5485/tcp,*:5358->5358/tcp,*:5373->5373/tcp,*:5375->5375/tcp,*:5421->5421/tcp,*:5331->5331/tcp,*:5345->5345/tcp,*:5464->5464/tcp,*:5480->5480/tcp,*:5496->5496/tcp,*:5347->5347/tcp,*:5381->5381/tcp,*:5390->5390/tcp,*:5450->5450/tcp,*:5470->5470/tcp,*:5490->5490/tcp,*:5415->5415/tcp,*:5419->5419/tcp,*:5318->5318/tcp,*:5329->5329/tcp,*:5330->5330/tcp,*:5336->5336/tcp,*:5343->5343/tcp,*:5348->5348/tcp,*:5434->5434/tcp,*:5466->5466/tcp,*:5478->5478/tcp,*:5488->5488/tcp,*:5301->5301/tcp,*:5335->5335/tcp,*:5362->5362/tcp,*:5462->5462/tcp,*:5360->5360/tcp,*:5429->5429/tcp,*:5452->5452/tcp,*:5458->5458/tcp,*:5304->5304/tcp,*:5361->5361/tcp,*:5409->5409/tcp,*:5414->5414/tcp,*:5483->5483/tcp,*:5407->5407/tcp,*:5408->5408/tcp,*:5306->5306/tcp,*:5313->5313/tcp,*:5314->5314/tcp,*:5357->5357/tcp,*:5393->5393/tcp,*:5406->5406/tcp,*:5417->5417/tcp,*:5457->5457/tcp,*:5487->5487/tcp,*:5321->5321/tcp,*:5339->5339/tcp,*:5365->5365/tcp,*:5413->5413/tcp,*:5418->5418/tcp,*:5448->5448/tcp,*:5437->5437/tcp,*:5445->5445/tcp,*:5326->5326/tcp,*:5337->5337/tcp,*:5355->5355/tcp,*:5392->5392/tcp,*:5400->5400/tcp,*:5436->5436/tcp,*:5460->5460/tcp,*:5447->5447/tcp,*:5451->5451/tcp,*:5308->5308/tcp,*:5316->5316/tcp,*:5382->5382/tcp,*:5391->5391/tcp,*:5401->5401/tcp,*:5411->5411/tcp,*:5456->5456/tcp,*:5454->5454/tcp,*:5481->5481/tcp,*:5302->5302/tcp,*:5305->5305/tcp,*:5351->5351/tcp,*:5356->5356/tcp,*:5364->5364/tcp,*:5446->5446/tcp,*:5497->5497/tcp,*:5465->5465/tcp,*:5475->5475/tcp,*:5322->5322/tcp,*:5369->5369/tcp,*:5376->5376/tcp,*:5388->5388/tcp,*:5438->5438/tcp,*:5443->5443/tcp,*:5498->5498/tcp,*:5300->5300/tcp,*:5325->5325/tcp,*:5398->5398/tcp,*:5403->5403/tcp,*:5424->5424/tcp,*:5489->5489/tcp,*:5359->5359/tcp,*:5363->5363/tcp,*:5397->5397/tcp,*:5426->5426/tcp,*:5442->5442/tcp,*:5342->5342/tcp,*:5352->5352/tcp,*:5367->5367/tcp,*:5395->5395/tcp,*:5482->5482/tcp,*:5319->5319/tcp,*:5320->5320/tcp,*:5377->5377/tcp,*:5430->5430/tcp,*:5440->5440/tcp,*:5486->5486/tcp,*:5328->5328/tcp,*:5338->5338/tcp,*:5371->5371/tcp,*:5387->5387/tcp,*:5399->5399/tcp,*:5494->5494/tcp,*:5323->5323/tcp,*:5384->5384/tcp,*:5394->5394/tcp,*:5439->5439/tcp,*:5459->5459/tcp,*:5474->5474/tcp,*:5307->5307/tcp,*:5353->5353/tcp,*:5455->5455/tcp,*:5433->5433/tcp,*:5461->5461/tcp,*:5312->5312/tcp,*:5368->5368/tcp,*:5372->5372/tcp,*:5385->5385/tcp,*:5402->5402/tcp,*:5431->5431/tcp,*:5473->5473/tcp,*:5317->5317/tcp,*:5346->5346/tcp,*:5350->5350/tcp,*:5354->5354/tcp,*:5412->5412/tcp,*:5444->5444/tcp,*:5463->5463/tcp,*:5477->5477/tcp,*:5309->5309/tcp,*:5334->5334/tcp,*:5349->5349/tcp,*:5370->5370/tcp,*:5396->5396/tcp,*:5441->5441/tcp,*:5344->5344/tcp,*:5468->5468/tcp,*:5479->5479/tcp
9thxlldzgs8n neon-proxy-manager replicated 1/1 neoncluster/neon-proxy-manager:latest
i7opo1sjkjfx neon-log-collector global 3/3 neoncluster/neon-log-collector:latest
o2v30wl8vblp neon-proxy-vault global 3/3 neoncluster/neon-proxy-vault:latest *:5003->8200/tcp
tey8vhd69qbf neon-log-kibana global 3/3 neoncluster/kibana:latest *:5001->5601/tcp
ttz1vc6yg242 neon-proxy-public global 3/3 neoncluster/neon-proxy:latest *:5261->5261/tcp,*:5269->5269/tcp,*:5125->5125/tcp,*:5192->5192/tcp,*:5163->5163/tcp,*:5213->5213/tcp,*:5214->5214/tcp,*:5256->5256/tcp,*:5289->5289/tcp,*:5106->5106/tcp,*:5126->5126/tcp,*:5129->5129/tcp,*:5157->5157/tcp,*:5159->5159/tcp,*:5165->5165/tcp,*:5181->5181/tcp,*:5219->5219/tcp,*:5108->5108/tcp,*:5123->5123/tcp,*:5296->5296/tcp,*:5267->5267/tcp,*:5291->5291/tcp,*:5258->5258/tcp,*:5272->5272/tcp,*:5274->5274/tcp,*:5295->5295/tcp,*:5202->5202/tcp,*:5255->5255/tcp,*:5264->5264/tcp,*:5281->5281/tcp,*:5243->5243/tcp,*:5262->5262/tcp,*:5197->5197/tcp,*:5201->5201/tcp,*:5206->5206/tcp,*:5218->5218/tcp,*:5130->5130/tcp,*:5148->5148/tcp,*:5137->5137/tcp,*:5149->5149/tcp,*:5179->5179/tcp,*:5198->5198/tcp,*:5228->5228/tcp,*:5250->5250/tcp,*:5111->5111/tcp,*:5133->5133/tcp,*:5297->5297/tcp,*:5167->5167/tcp,*:5171->5171/tcp,*:5207->5207/tcp,*:5208->5208/tcp,*:5224->5224/tcp,*:5124->5124/tcp,*:5146->5146/tcp,*:5186->5186/tcp,*:5220->5220/tcp,*:5229->5229/tcp,*:5231->5231/tcp,*:5265->5265/tcp,*:5162->5162/tcp,*:5166->5166/tcp,*:5248->5248/tcp,*:5277->5277/tcp,*:5174->5174/tcp,*:5244->5244/tcp,*:5284->5284/tcp,*:5287->5287/tcp,*:5290->5290/tcp,*:5158->5158/tcp,*:5215->5215/tcp,*:5153->5153/tcp,*:5164->5164/tcp,*:5173->5173/tcp,*:5205->5205/tcp,*:5236->5236/tcp,*:5138->5138/tcp,*:5141->5141/tcp,*:5176->5176/tcp,*:5193->5193/tcp,*:5209->5209/tcp,*:5221->5221/tcp,*:5238->5238/tcp,*:5260->5260/tcp,*:5127->5127/tcp,*:5140->5140/tcp,*:5286->5286/tcp,*:5292->5292/tcp,*:5185->5185/tcp,*:5188->5188/tcp,*:5191->5191/tcp,*:5210->5210/tcp,*:5257->5257/tcp,*:5288->5288/tcp,*:5122->5122/tcp,*:5169->5169/tcp,*:5152->5152/tcp,*:5271->5271/tcp,*:5283->5283/tcp,*:5293->5293/tcp,*:5172->5172/tcp,*:5195->5195/tcp,*:5183->5183/tcp,*:5196->5196/tcp,*:5203->5203/tcp,*:5225->5225/tcp,*:5266->5266/tcp,*:5131->5131/tcp,*:5132->5132/tcp,*:5118->5118/tcp,*:5139->5139/tcp,*:5143->5143/tcp,*:5156->5156/tcp,*:5237->5237/tcp,*:5273->5273/tcp,*:5103->5103/tcp,*:5114->5114/tcp,*:5280->5280/tcp,*:5247->5247/tcp,*:5251->5251/tcp,*:5102->5102/tcp,*:5216->5216/tcp,*:5177->5177/tcp,*:5182->5182/tcp,*:5189->5189/tcp,*:5211->5211/tcp,*:5233->5233/tcp,*:5234->5234/tcp,*:5107->5107/tcp,*:5155->5155/tcp,*:5270->5270/tcp,*:5285->5285/tcp,*:5240->5240/tcp,*:5245->5245/tcp,*:5145->5145/tcp,*:5160->5160/tcp,*:5199->5199/tcp,*:5204->5204/tcp,*:5230->5230/tcp,*:5235->5235/tcp,*:5105->5105/tcp,*:5134->5134/tcp,*:5275->5275/tcp,*:5294->5294/tcp,*:5121->5121/tcp,*:5142->5142/tcp,*:5175->5175/tcp,*:5184->5184/tcp,*:5252->5252/tcp,*:5276->5276/tcp,*:5282->5282/tcp,*:5115->5115/tcp,*:5120->5120/tcp,*:5147->5147/tcp,*:5154->5154/tcp,*:5168->5168/tcp,*:5239->5239/tcp,*:5241->5241/tcp,*:5253->5253/tcp,*:5117->5117/tcp,*:5128->5128/tcp,*:5249->5249/tcp,*:5259->5259/tcp,*:5279->5279/tcp,*:5109->5109/tcp,*:5112->5112/tcp,*:5217->5217/tcp,*:5242->5242/tcp,*:5100->5100/tcp,*:5190->5190/tcp,*:5223->5223/tcp,*:5246->5246/tcp,*:5278->5278/tcp,*:5116->5116/tcp,*:5161->5161/tcp,*:5150->5150/tcp,*:5187->5187/tcp,*:5263->5263/tcp,*:5268->5268/tcp,*:5110->5110/tcp,*:5113->5113/tcp,*:5170->5170/tcp,*:5136->5136/tcp,*:5144->5144/tcp,*:5180->5180/tcp,*:5212->5212/tcp,*:5232->5232/tcp,*:5101->5101/tcp,*:5119->5119/tcp,*:5178->5178/tcp,*:5200->5200/tcp,*:5222->5222/tcp,*:5226->5226/tcp,*:5227->5227/tcp,*:5299->5299/tcp,*:5104->5104/tcp,*:5135->5135/tcp,*:5254->5254/tcp,*:5298->5298/tcp,*:5151->5151/tcp,*:5194->5194/tcp
x9zio659iilb neon-cluster-manager replicated 1/1 neoncluster/neon-cluster-manager:latest

Output of docker version:

Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Fri May 5 15:36:11 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Fri May 5 15:36:11 2017
OS/Arch: linux/amd64
Experimental: true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions