How to list just container names & IP address(es) of all Docker conatiners
Also see:
- How to list just container ID of all Docker containers
- How to list just container names of all Docker containers
Use
docker ps -q | xargs -n1 docker inspect --format '{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
Example output:
$ docker ps -q | xargs -n1 docker inspect --format '{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
/flamboyant_cohen 10.254.1.6
/flamboyant_cohen 10.254.1.6
/lucid_shtern 10.254.1.4
This solution was inspired by GitHub user zeroows on GitHub Gists