Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Docker Images Tree Visualization

DZone's Guide to

Docker Images Tree Visualization

See how you can still get a hierarchy tree visualization of the images in your container after the most recent Docker release.

· DevOps Zone ·
Free Resource

Is the concept of adopting a continuous everything model a daunting task for your fast moving business? Read this whitepaper to break down and understand one of the key pillars of this model in Continuous Governance: The Guardrails for Continuous Everything.

In the recent Docker release, you might be surprised that the tree view no longer works as expected:

 $ docker images --tree 

The above command would produce a visual dump of the images inside the container. The command generated a hierarchy of the images, showing the relationship between parent and children. However, this command has been dropped since Docker version 1.6. So what do you do?

You can use the custom document plugin images, DockViz from JustOne of Github.

The simplest way is to start up the Docker image and log in as a Bash user. Upgrade yourself to root superuser and then launch the following command:

 $ alias dockviz="docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz" 

Now execute the alias:

 $ docker dataviz -t 

This command downloads the DockViz image then executes Docker API using the protocol, obviously over the named UNIX socket. The result is a hierarchy tree of the images in your container, very similarly to “docker images -t.”

If you have trouble getting access to /var/run/docker.sock even as “root” superuser. Try the following by adding the –privileged flag to the alias command. Run the following command:

 $ alias dockviz="docker run -it --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz" 

My final tip is add the “alias” to the login script for the superuser. Here is the command for that:

 $ echo 'alias dockviz="docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz"' > ~/.bash_profile 

This is because RHEL, CentOS and SE Linux restrict access to the docker socket even for superusers. Channeling “SECURITAH!” @SwiftOfSecurity ��

Are you looking for greater insight into your software development value stream? Check out this whitepaper: DevOps Performance: The Importance of Measuring Throughput and Stability to see how CloudBees DevOptics can give you the visibility to improve your continuous delivery process.

Topics:
devops ,docker ,containers ,visualizations

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}