tldr/pages/common/docker-inspect.md

33 lines
970 B
Markdown
Raw Normal View History

2020-09-22 18:14:00 +01:00
# docker inspect
> Return low-level information on Docker objects.
> More information: <https://docs.docker.com/engine/reference/commandline/inspect/>.
- Display help:
2020-09-22 18:14:00 +01:00
`docker inspect`
- Display information about a container, image, or volume using a name or ID:
`docker inspect {{container|image|ID}}`
- Display a container's IP address:
`docker inspect --format '\{\{range.NetworkSettings.Networks\}\}\{\{.IPAddress\}\}\{\{end\}\}' {{container}}`
2020-09-22 18:14:00 +01:00
- Display the path to the container's log file:
`docker inspect --format='\{\{.LogPath\}\}' {{container}}`
2020-09-22 18:14:00 +01:00
- Display the image name of the container:
`docker inspect --format='\{\{.Config.Image\}\}' {{container}}`
2020-09-22 18:14:00 +01:00
- Display the configuration information as JSON:
`docker inspect --format='\{\{json .Config\}\}' {{container}}`
2020-09-22 18:14:00 +01:00
- Display all port bindings:
`docker inspect --format='\{\{range $p, $conf := .NetworkSettings.Ports\}\} \{\{$p\}\} -> \{\{(index $conf 0).HostPort\}\} \{\{end\}\}' {{container}}`