The container is the runtime environment for the image, so the meta-data for containers must provide all of the runtime configurations needed to start and restart the image with all of its settings intact.
The results from inspecting a container have very different options. Virtual Size The size of the image reported in bytes. It could be very useful as the Docker ecosystem continues to advance. Docker will create a container during the image construction process, and this identifier is stored in the image data.ĬontainerConfig This data again is referring to the temporary container created when the Docker build command was executed.ĭockerVersion The version of Docker used to create the image is stored in this value. This container identifier is a temporary container created when the image was built.
It is very common for an image to have a defined parent.Ĭontainer A container identifier is interesting because this is meta-data for an image not a container. Parent A link to the identifier of the parent image. ID This is the unique identifier of the image. "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Most of the elements are pretty easy to understand but a few of them may not be as obvious. The results of inspecting an image differ from the results of inspecting a container. This format string follows go templating which may require some additional learning to use in detail but in general it's pretty easy to get the information you need from the results. This allows the results to be filtered on a specific stanza of the inspection result. One of the options for inspect is the format option. The last example above mixes images and containers in the same result which is valid. docker inspect cocky_bohr c9e23ca73a66ĭocker inspect centurylink/watchtower f76c0f6b907fĭocker inspect f76c0f6b907f centurylink/watchtower cocky_bohr Using the results above, valid inspect commands could be: docker inspect c9e23ca73a66Īll of the previous examples only inspected a single item but it is possible to inspect multiple combinations of images and/or containers in a single command. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESĬ9e23ca73a66 centurylink/watchtower "/watchtower" 4 days ago Up 4 daysĢff6adf54f4a centurylink/watchtower "/watchtower" 4 days ago Exited (1) 4 days ago cocky_bohrĬontainers have both a name and identifier either can be used to identify the container to inspect. The ps command by default shows only running containers but passing the -a flag to the command will show all containers. Using the results above a valid inspect command could be the following: docker inspect f76c0f6b907f REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEĬenturylink/watchtower latest f76c0f6b907f 5 days ago 5.871 MBĬenturylink/panamax-api latest 9f00b0d73e96 7 weeks ago 93.58 MBįor images the Repository name or the Image ID can be used to identify the images. Either the name or id can be used to identify an image or container, and by using docker images a list of local images can be found. f, -format= Format the output using the given go templateīased on the help output, the inspect command can be run on one or more images or containers. Return low-level information on a container or image Typing docker inspect -help will generate the following help documentation.
#DOCKER INSPECT FORMAT LABELS HOW TO#
How to inspectĮvery Docker command has built in documentation. This article will explain running docker inspect and detailing the results. However, there is little information about interpreting the output. Inspect is a core Docker instruction with detailed documentation. Fortunately, there is a way to unlock both structures using the docker inspect command. It is common to think of Docker images and containers as mystical black boxes where all the application goodness gets locked away.