Get the IP addresses of your Docker containers

Published at 04 Oct 2024

When you create Docker container, it gets a dynamic IP if you not hardcoded one at while creating it.

Running the following command will give you a list of the containers with the configured IP address.

docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';