Getting the IP address of a docker container is easy but it is important to understand a few things about docker networks.

Wondering what’s the IP address of your running docker container? You can inspect the running container to get that information.

sudo docker container inspect container_name_or_ID

Don’t know the container’s name or ID? Use the command sudo docker ps.

The inspect command gives you many details about the container you are inspecting. Go towards the end and look into the Networks section to get the container’s IP address.

You may also use grep command to get just the lines matching the string “IPAddress”.

Don’t be alarmed if your container has more than one IP address. That’s not unusual. To understand that, you need to understand how containers communicate with each other.

I’ll explain that to you in the next section followed by some other methods of getting the IP address of a running docker container.

#docker #container

How to Get IP Address of a Docker Container
1.50 GEEK