{"id":2443,"date":"2017-08-07T14:21:24","date_gmt":"2017-08-07T13:21:24","guid":{"rendered":"http:\/\/www.xenonique.co.uk\/blog\/?p=2443"},"modified":"2017-08-07T14:37:12","modified_gmt":"2017-08-07T13:37:12","slug":"docker-images-tree-visualisation","status":"publish","type":"post","link":"https:\/\/www.xenonique.co.uk\/blog\/2017\/08\/07\/docker-images-tree-visualisation\/","title":{"rendered":"Docker Images Tree Visualisation"},"content":{"rendered":"<p>Docker Post<\/p>\n<p>On recent Docker release, you might be surprised that the tree view no longer works as expected:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ docker images --tree\r\n<\/pre>\n<p>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?<\/p>\n<p>You can use the custom document plugin images, <a href=\"https:\/\/github.com\/justone\/dockviz\">DockViz from JustOne<\/a> of Github (<a href=\"https:\/\/github.com\/justone\/dockviz\">https:\/\/github.com\/justone\/dockviz<\/a>).<\/p>\n<p>The simplest way is start up the docker image and login as a Bash user. Upgrade yourself to root superuser and then launch the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ alias dockviz=&quot;docker run -it --rm -v \/var\/run\/docker.sock:\/var\/run\/docker.sock nate\/dockviz&quot;\r\n<\/pre>\n<p>Now execute the alias:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ docker dataviz -t\r\n<\/pre>\n<p>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 &#8220;docker images -t&#8221;<\/p>\n<p>If you have trouble getting access to \/var\/run\/docker.sock even as &#8220;root&#8221; superuser. Try the following by adding the &#8211;privileged flag to the alias command. Run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ alias dockviz=&quot;docker run -it --privileged --rm -v \/var\/run\/docker.sock:\/var\/run\/docker.sock nate\/dockviz&quot;\r\n<\/pre>\n<p>My final tip is add the &#8220;alias&#8221; to the login script for the superuser. Here is the command for that:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ echo 'alias dockviz=&quot;docker run -it --rm -v \/var\/run\/docker.sock:\/var\/run\/docker.sock nate\/dockviz&quot;' &gt; ~\/.bash_profile\r\n<\/pre>\n<p>This is because RHEL, CentOS and SE Linux restrict access to the docker socket even for superusers. Channeling &#8220;SECURITAH!&#8221; <a href=\"https:\/\/twitter.com\/SwiftOnSecurity\">@SwiftOfSecurity<\/a> \ud83d\ude09 <\/p>\n<p>+PP+<br \/>\nJune 2017<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker Post On recent Docker release, you might be surprised that the tree view no longer works as expected: 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[80,111,194,193,81,82,139],"tags":[],"_links":{"self":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2443"}],"collection":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=2443"}],"version-history":[{"count":2,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2443\/revisions"}],"predecessor-version":[{"id":2449,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2443\/revisions\/2449"}],"wp:attachment":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=2443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=2443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=2443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}