The following command will make a list with all docker container names and their respective IPs.
For the containers that have multiple IPs it will printed them on the same row as their name.
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';
This post is also available in: Greek
thanks.
Brilliant, thanks!
My docker container didn’t had ‘ip’ command and curl command. Found this after spending 3 hours on internet. It worked as expected. Thanks lot !
Worked like charm, thank you!