https://github.com/silenceshell/topic
top in container.
https://github.com/silenceshell/topic
Last synced: about 2 months ago
JSON representation
top in container.
- Host: GitHub
- URL: https://github.com/silenceshell/topic
- Owner: silenceshell
- License: mit
- Created: 2021-09-03T08:52:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-08T14:15:54.000Z (over 2 years ago)
- Last Synced: 2024-10-31T04:35:04.566Z (7 months ago)
- Language: Go
- Homepage:
- Size: 229 KB
- Stars: 144
- Watchers: 4
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ops - silenceshell/topic - 09-03|2022-10-08 | 基于 Golang 实现的容器内运行 top 命令的工具 | (Docker-Tools)
README
# topic
top in container.
Running the original `top` command in a container will not get information of the container, many metrics like uptime, users, load average, tasks, cpu, memory, are about the host in fact.
`topic`(**top** **i**n **c**ontainer) will retrieve those metrics from container instead, and shows the status of the container, not the host.Below shows a container of 2 cpu and 2 Gi running status when stress with `--cpu 2`.

## How to use
Download `topic` from GitHub [release page](https://github.com/silenceshell/topic/releases) to the container which you want to inspect, and add `x` attribute to the binary, then run the binary!
Or just create a container for a try:
```sh
# start a 2c2g container
$ docker run -it --name topic --rm --cpus 2 --memory 2g silenceshell/topic bash
# run topic in this container
root@04065eeff138:/# topic
```## How to build
Run `make build` for linux and amd64. `topic` only support on linux. If you want to run on other architectures, `GOARCH` is need to be set.