Visualizing the image hierarchy
Docker provides multiple commands to learn about its images in a textual format. However, a picture is worth a thousand words, so it is imperative that we can visualize the image hierarchy through graphs. While Docker doesn't support any image visualization tool, numerous solutions are available to visualize the image hierarchy. In this recipe, we will visualize the image hierarchy using a nate/dockviz
container and Graphviz
.
Getting ready
Before we begin, we need one or more Docker images on the host to be running a Docker daemon. We also need to ensure that Graphviz
is installed.
How to do it...
Run the nate/dockviz
container by supplying images --dot
as a command-line argument and pipe the output to the dot
(Graphviz
) command, as shown in the following code, to generate the image hierarchy:
$ docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ nate/dockviz \ images --dot | dot -Tpng -o images-graph.png
The following...