Friday, August 14, 2020

How to Read Docker Inspect Output

Here is quick easy set of instructions as how to read docker inspect output:

First you run the command:

docker inspect <image id> or <container id>

and then it outputs in JSON format. Your normally are interested in what exactly is in this docker image which you have just pulled from web or inherited in your new job. 

Now copy this JSON output and put it in VSCode or any of online JSON editor of your choice. For a quick glance, look at the node "ContainerConfig." This node tells you what exactly was run within the temporary container which was used to build this image such as CMD, EntryPoint etc. 

In addition to the above, following is the description of all the important bits of information found in Inspect command output:

  • ID: It's unique identifier of the image.
  • Parent: A link to the identifier of the parent image of this image. 
  • Container: The temporary container created when the image was built.
  • ContainerConfig: Contains what happened in that temporary container.
  • DockerVersion: Version of Docker used to create the image

Virtual Size: Image size in bytes.

I hope that helps.

No comments: