In this step, you will learn how to inspect a Docker image to view detailed information about it. The docker inspect
command provides a wealth of information about Docker objects, including images, containers, networks, and volumes. By default, it outputs the information in a structured format.
To inspect an image, you use the docker inspect
command followed by the image name or ID. Let's inspect the hello-world
image that you pulled in the previous step.
docker inspect hello-world
This command will output a large amount of information about the hello-world
image in a default format. The output includes details such as the image ID, creation date, architecture, operating system, and configuration.
[
{
"Id": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"RepoTags": ["hello-world:latest"],
"RepoDigests": [
"hello-world@sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591"
],
"Parent": "",
"Comment": "",
"Created": "2023-03-07T21:50:09.004511104Z",
"Container": "a928b81f51a91111111111111111111111111111111111111111111111111111",
"ContainerConfig": {
"Hostname": "a928b81f51a9",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": ["/hello"],
"Image": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "20.10.21",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": ["/hello"],
"Image": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1330,
"VirtualSize": 1330,
"GraphDriver": {
"Data": null,
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2db29710123e5455b34e722505b562504b39e55355e344405b54d3153a94650b"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
This default output provides a comprehensive view of the image's configuration and metadata. In the next steps, you will learn how to format this output to extract specific information.