Sunday, November 22, 2026
TR
LinuxOpen Source

How to Get the IP Address of a Docker Container

How to Get the IP Address of a Docker Container

This tutorial will help you get the IP address of a Docker container on your system. The Docker binary provides the network option to manage networking for the Docker environment. You can also use the inspect option to find the details of a Docker container. In this tutorial, we use the inspect option to get the Docker container IP address from the command line.

Syntax

Use the following syntax to get the IP address of a Docker container. You need to replace CONTAINER ID/NAME with the actual container ID or name.

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <CONTAINER ID/NAME>

Example

For example, suppose you have a Docker container with the container ID 1808352f0693. Run the following command in the terminal.

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 1808352f0693

Output

172.17.0.2

Kerim Koç

Systems and infrastructure engineer. I write about Linux, open source, high availability and security.