Docker Course
Docker
/
Intermediate

docker inspect

Definition

A diagnostic CLI command that returns low-level, highly detailed JSON metadata about Docker objects (containers, images, networks, or volumes).

Explain Like I'm New

The ultimate X-Ray vision tool. It spits out a massive wall of JSON text telling you every single technical detail about a container, from its IP address to its mapped volumes.

Real World Example

Two containers on a custom network cannot communicate. A DevOps engineer runs `docker inspect network my-net`. The JSON output reveals that one of the containers was accidentally connected to the wrong subnet.

Common Use Cases

  • •Advanced debugging
  • •Finding IP addresses
  • •Verifying configurations

Interview Questions

basic

  • What format does the `docker inspect` command output its data in?

intermediate

  • How can you extract just the IP Address from the massive wall of text `docker inspect` produces without reading the whole thing?

Flash Cards

Question

Which format?

Click to reveal answer
Answer

JSON (JavaScript Object Notation).

Question

How to extract specific data?

Click to reveal answer
Answer

Using the `--format` flag (which uses Go templates). For example: `docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container`.