bcicen / ctop

Top-like interface for container metrics
https://ctop.sh
MIT License
15.6k stars 528 forks source link

[Feature] Add Docker context-aware support #349

Open CheyiLin opened 9 months ago

CheyiLin commented 9 months ago

Currently the only way to use ctop with Docker servers use non-default endpoint unix:///var/run/docker.sock is to set/override DOCKER_HOST environment variable.

For instance, with colima (refs):

export DOCKER_HOST=unix:///${HOME}/.colima/default/docker.sock

Would like to have Docker context-aware support so ctop can work with other Docker servers accordingly:

$ docker context list
NAME              DESCRIPTION                               DOCKER ENDPOINT                                     ERROR
colima *          colima                                    unix:///Users/*****/.colima/default/docker.sock
default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
rancher-desktop   Rancher Desktop moby context              unix:///Users/*****/.rd/docker.sock

$ docker context show
colima

$ docker context use rancher-desktop
rancher-desktop
Current context is now "rancher-desktop"

Feedback is welcome!