# How to Get a Docker Container’s Ip Address from the Host?

By default, the container is assigned an IP address for every Docker network it connects to. And each network is created with a default subnet mask, using it as a pool, later on, to give away the IP addresses.

## How to get the IP address?

To get the IP address of a Docker container, you can use the `inspect` command, alongside the `-format` option as shown below:

**On Linux**

```bash
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
```

**On Windows**

```bash
docker inspect -f "{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}" container_name_or_id
```

The command will return the Docker container’s IP address.
