How to show all Docker contains with just name & IP address
The following command will list all running Docker containers with their names and IP addresses:
docker ps -a --format "{{.Names}}" | xargs -I {} docker inspect --format "{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" {}
Example output
/mycontainer1 192.168.1.2
/web-server 172.17.0.3
/database-prod 10.0.0.15
/redis-cache 192.168.100.8
/nginx-proxy 172.20.0.4
/api-backend 10.1.1.23
/monitoring-stack 192.168.50.12
/elasticsearch-node 172.18.0.7
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow