{"id":1519,"date":"2022-10-20T09:43:14","date_gmt":"2022-10-20T16:43:14","guid":{"rendered":"https:\/\/jasonsblog.access.ly\/?p=1519"},"modified":"2022-11-07T13:48:30","modified_gmt":"2022-11-07T20:48:30","slug":"ctop-for-docker-cli-track-and-interact-with-docker-instances","status":"publish","type":"post","link":"https:\/\/jasonsblog.ddns.net\/index.php\/2022\/10\/20\/ctop-for-docker-cli-track-and-interact-with-docker-instances\/","title":{"rendered":"CTOP for Docker &#8211; CLI Track and Interact With Docker Instances"},"content":{"rendered":"\n<p>Previously I had wrote about <a href=\"https:\/\/jasonsblog.ddns.net\/index.php\/2022\/03\/20\/manage-docker-with-portainer\/\" target=\"_blank\" rel=\"noreferrer noopener\">Portainer<\/a> to track Docker Instances, but I&#8217;ve now found <a aria-label=\"CTOP (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\" href=\"https:\/\/github.com\/bcicen\/ctop\" target=\"_blank\">CTOP<\/a> which I find more useful. And on a Dell Poweredge server I had Portainer not show an issue with my Unbound containers as part of my Pihole stacks. But instantly in CTOP I could see there was a problem with them being down with restarts failing, and all I had to do was highlight the instance and hit a left arrow to view the log file for the reason. Portainer of course has a lot of value in tracking a lot of docker machines with some other functionalities, but CTOP is better to manage individual machines and interact with the instances more quickly.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"310\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop1.png\" alt=\"\" class=\"wp-image-2045\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop1.png 1017w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop1-300x91.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop1-768x234.png 768w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><figcaption class=\"wp-element-caption\">Main CTOP view of instances with CPU load<\/figcaption><\/figure>\n\n\n\n<p>Above is the main view of CTOP, and if you hit the right arrow on a docker instance you get a more detailed screen with information on the instance, CPU graph, network traffic&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"968\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop2.png\" alt=\"\" class=\"wp-image-2046\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop2.png 627w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop2-194x300.png 194w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><figcaption class=\"wp-element-caption\">Docker application details<\/figcaption><\/figure>\n\n\n\n<p>If you hit the left arrow key on an instance you can see the log file.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"944\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop3-1024x944.png\" alt=\"\" class=\"wp-image-2047\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop3-1024x944.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop3-300x277.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop3-768x708.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop3.png 1050w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Docker application log<\/figcaption><\/figure>\n\n\n\n<p>By hitting the enter key you are greeted with a list of interactions like stopping, restarting, pausing, executing the shell within the instance.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"332\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop4-1024x332.png\" alt=\"\" class=\"wp-image-2048\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop4-1024x332.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop4-300x97.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop4-768x249.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop4.png 1050w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">CTOP Menu<\/figcaption><\/figure>\n\n\n\n<p>Hitting the h key brings up the help menu so you can see what else is available like sorting, changing fields in the view&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"441\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop5-1024x441.png\" alt=\"\" class=\"wp-image-2049\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop5-1024x441.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop5-300x129.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop5-768x331.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/ctop5.png 1050w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">CTOP help<\/figcaption><\/figure>\n\n\n\n<p>To run CTOP you&#8217;ll need to install the Go language which should be in the repo for your distribution, but to run the latest version you can download from Google following these <a aria-label=\"instructions (opens in a new tab)\" href=\"https:\/\/www.jeremymorgan.com\/tutorials\/raspberry-pi\/install-go-raspberry-pi\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">instructions<\/a>. Today the repo has version 1.15 with 1.19 available from Google.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install golang<\/code><\/pre>\n\n\n\n<p>You&#8217;ll then need to clone the git repo of CTOP and compile the application, and then copy the binary to your bin path. Note, with git tag you have to hit q to exit the view and return to the command prompt. And as this could be dated by the time you read it, use the latest version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/bin\ncd ~\/bin\ngit clone https:\/\/github.com\/bcicen\/ctop.git\ncd ctop\ngit tag  \ngit checkout v0.7.7 <\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"920\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop7-1-1024x920.png\" alt=\"\" class=\"wp-image-2025\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop7-1-1024x920.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop7-1-300x270.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop7-1-768x690.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop7-1.png 1048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then we&#8217;ll compile the file and copy it to our bin directory so it can be run.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make build\nsudo cp ctop \/usr\/local\/bin<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"352\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop8-1-1024x352.png\" alt=\"\" class=\"wp-image-2026\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop8-1-1024x352.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop8-1-300x103.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop8-1-768x264.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop8-1.png 1048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And you can check your version and it will also show the Go version it was compiled with.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"200\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop9-1-1024x200.png\" alt=\"\" class=\"wp-image-2027\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop9-1-1024x200.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop9-1-300x59.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop9-1-768x150.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/10\/ctop9-1.png 1048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And now you can track your docker instances and interact with them from the terminal with CTOP. Hopefully as the project grows it will be included in the standard repos. <\/p>\n\n\n\n<p>Note: There is a bug when compiled for Arm systems where the memory is zero, but this works on x86 based servers. So I&#8217;ve submitted a bug report and you can find the memory usage with the &#8216;docker stats -a&#8217; command. Being only version 0.7.7 this is a new project and hasn&#8217;t reached version 1 yet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously I had wrote about Portainer to track Docker Instances, but I&#8217;ve now found CTOP which I find more useful. And on a Dell Poweredge server I had Portainer not show an issue with my Unbound containers as part of my Pihole stacks. But instantly in CTOP I could see there was a problem with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1519","post","type-post","status-publish","format-standard","hentry","category-tech"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"featured_image_src":null,"author_info":{"display_name":"Jason","author_link":"https:\/\/jasonsblog.ddns.net\/index.php\/author\/jturning\/"},"_links":{"self":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=1519"}],"version-history":[{"count":9,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1519\/revisions"}],"predecessor-version":[{"id":2099,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1519\/revisions\/2099"}],"wp:attachment":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/categories?post=1519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/tags?post=1519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}