Get a List of all Ports Used by Docker Containers

Published: 2024-06-12 | Updated: 2024-06-10

I was spinning up a new local dev site and was surprised to learn the port I selected on which to serve the site was taken. Shocked, I tell you!

Some searching led me to this StackOverflow page where I found this nugget:

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

So I’m pasting it here because next time I need it I won’t have to suffer through that horrid search experience again.