Imported from whyhilde/dockerfetch (
AGENTS.md). Install upstream withnpx skills add whyhilde/dockerfetch. Copyright stays with the author.
dockerfetch
Neofetch-style CLI for Docker info.
Build & Verify
go build -o dockerfetch .
go run . # full output
go run . --short # essential only
go run . --json # JSON output
go run . --no-color # monochrome
go vet ./...
go test ./...
gofmt -s -w . # format
Package layout
main.go # flags, orchestration
internal/docker/client.go # Docker SDK — Fetch() returns *DockerInfo
internal/docker/types.go # DockerInfo, ContainerSummary, Line
internal/ascii/logo.go # ASCII art constants (Fedora, Ubuntu, Debian, Arch, Alpine, macOS)
internal/display/render.go # side-by-side table + JSON
internal/display/color.go # ANSI wrappers, NoColor flag
internal/system/info.go # host OS, kernel, uptime, OSID
Key decisions
- ASCII default: OS logo detected from
/etc/os-release; falls back to Ubuntu - Connection: Unix socket +
DOCKER_HOSTenv (via Docker SDK'sFromEnv) - Flags:
--short,--no-color,--json - Colors: ANSI by default;
--no-colordisables - Field order: OS → Docker → API → Cgroup → Storage → Root → CPUs → Memory → Containers → Images → Volumes → Networks
- Container statuses: running / paused / stopped — from
docker infodirectly - Networks filter: built-in ingress networks excluded
- OS detection:
system.Get()reads/etc/os-releaseforID=field; logo selected byascii.Get(osID) - Logos sourced from: fastfetch — backtick characters replaced with
'to avoid Go raw string conflicts
Notes
- Requires running Docker daemon
- Docker SDK pulled via
go mod tidy(github.com/moby/moby/client + api) - ANSI codes use
\033literals (not\e) - The
internal/system/info.goreads/proc(Linux only); Darwin/Windows fall back toruntime.GOOS
