How Do You Find the IP Address Assigned to a Docker Container When It Was Created?

Problem scenario
You have inherited several Docker containers to manage.  They were assigned IP addresses and assigned user-defined networks when they were created.  You do not know what IP addresses that they were given.  You want to know the IP addresses so you can add them to a load balancer.  The external IP address of the Docker host combined with identifying port numbers of the containers can create sockets that are unique.  But you want the internal IP addresses of each of the Docker containers.  How do you find them?

Run a command like this but substitute "8debfc9b4c32" for the container ID as found in the results of a "docker ps -a" command:

docker inspect 8debfc9b4c32 | grep IPAddress | tail -n 1

Leave a comment

Your email address will not be published. Required fields are marked *