(Last Updated On: March 3, 2019)

Have you been searching for a top like interface for container metrics and monitoring?. Ctop is a command line tool written to provide a concise and condensed overview of real-time metrics for containers running in your system. This command line tool comes with built-in support for both Docker and runC container engines.

Installing ctop on Linux / macOS

Ctop is written in Go and distributed as binary file which you can quickly download from Github and install it. Fetch the latest release for your platform and download with your wget or curl command.

Install ctop on Linux

export VER="0.7.2"
wget https://github.com/bcicen/ctop/releases/download/v${VER}/ctop-${VER}-linux-amd64 -O ctop
chmod +x ctop
sudo mv ctop /usr/local/bin/ctop

Install ctop on macOS

If you’re running OS X, you can install ctop with brew or by downloading the latest pre-built binary file from Github.

Install ctop with brew:

brew install ctop

For manual package download, it is similar to below.

export VER="0.7.2"
sudo curl -Lo ctop https://github.com/bcicen/ctop/releases/download/v${VER}/ctop-${VER}-darwin-amd64
chmod +x ctop
sudo mv ctop /usr/local/bin/ctop

Confirm that is working.

$ ctop  --help
Usage of ctop:
-a show active containers only
-connector string
container connector to use (default "docker")
-f string
filter containers
-h display this help dialog
-i invert default colors
-r reverse container sort order
-s string
select container sort field
-scale-cpu
show cpu as % of system total
-v output version information and exit

Running ctop in Docker container

If you have big love for containers, you can run ctop in a docker container. But first install Docker in your system using the guide below,

How to install Docker CE on Linux

Once docker is installed and running, spin up ctop container by running:

docker run --rm -ti \
--name=ctop \
-v /var/run/docker.sock:/var/run/docker.sock \
quay.io/vektorlab/ctop:latest

Running ctop

Using ctop is easy, just run the command ctop and you should get containers metrics displayed to you in realtime.

$ ctop

Sample output

Ctop Keybindings

KeyAction
<enter>Open container menu
aToggle display of all (running and non-running) containers
fFilter displayed containers (esc to clear when open)
HToggle ctop header
hOpen help dialog
sSelect container sort field
rReverse container sort order
oOpen single view
lView container logs (t to toggle timestamp when open)
SSave current configuration to file
qQuit ctop

Other interesting container articles.

How to Optimize Linux System with Stacer

How to Deploy and Use Dokku on Ubuntu 18.04

How to Install Minikube on Ubuntu 18.04

Install Docker and Docker Compose on Linux Mint 19

How to run Docker Containers on Windows Server 2019

How to setup 3 node Kubernetes Cluster on Ubuntu 18.04 with Weave Net CNI