CTOP for Docker – CLI Track and Interact With Docker Instances

Previously I had wrote about Portainer to track Docker Instances, but I’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 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.

Main CTOP view of instances with CPU load

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…

Docker application details

If you hit the left arrow key on an instance you can see the log file.

Docker application log

By hitting the enter key you are greeted with a list of interactions like stopping, restarting, pausing, executing the shell within the instance.

CTOP Menu

Hitting the h key brings up the help menu so you can see what else is available like sorting, changing fields in the view…

CTOP help

To run CTOP you’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 instructions. Today the repo has version 1.15 with 1.19 available from Google.

sudo apt install golang

You’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.

mkdir ~/bin
cd ~/bin
git clone https://github.com/bcicen/ctop.git
cd ctop
git tag  
git checkout v0.7.7 

Then we’ll compile the file and copy it to our bin directory so it can be run.

make build
sudo cp ctop /usr/local/bin

And you can check your version and it will also show the Go version it was compiled with.

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.

Note: There is a bug when compiled for Arm systems where the memory is zero, but this works on x86 based servers. So I’ve submitted a bug report and you can find the memory usage with the ‘docker stats -a’ command. Being only version 0.7.7 this is a new project and hasn’t reached version 1 yet.