How to list exposed port of all containers?

WeSee picture WeSee · Apr 13, 2018 · Viewed 24.6k times · Source

We have lots of containers started using Rancher with each container exposing multiple ports. Since we started the containers with Rancher, no port is exposed to the host by default.

$ docker container ls 

shows no exposed ports for containers started by rancher. Rancher CLI rancheris not installed.

How to list ports which are exposed within the rancher network? Is this possible using the docker command? Or do I need rancher?

Answer

Sergey picture Sergey · Nov 27, 2019

for show ports on one host you can try to use

docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a

more examples you can find here docker-container-ls by manpages.ubuntu.com