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

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

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 ��

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

Topics:
devops ,docker ,containers ,visualizations

Published at DZone with permission of Peter Pilgrim, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}