moby/moby
pkg/ — legacy utilities
Purpose
pkg/ is the historic home for general-purpose utility packages that aren't tied to the daemon's domain model. Per pkg/README.md:
pkg/is a collection of utility packages used by the Moby project without being specific to its internals. Utility packages are kept separate from the moby core codebase to keep it as small and concise as possible.
CONTRIBUTING.md explicitly says no new packages should be added here. New utilities go under daemon/internal/. Some pkg/ packages have already moved to dedicated repos under the Moby org (e.g. moby/sys/...).
What's still here
| Package | Role |
|---|---|
pkg/authorization/ |
The authorization plugin chain. Used by Plugins. |
pkg/plugins/ |
Legacy v1 plugin protocol (JSON-over-Unix-socket). |
pkg/plugingetter/ |
Common interface for "look up a plugin by name and capability". |
pkg/sysinfo/ |
Host capability detection (cgroups, seccomp, apparmor, kernel features). |
pkg/process/ |
Process tree helpers (used by stats and exec). |
pkg/meminfo/ |
Read /proc/meminfo per-OS. |
pkg/parsers/ |
Kernel version, OS release, cgroup parsers. |
pkg/pidfile/ |
PID file write/check helpers. |
pkg/ioutils/ |
Atomic file write, multireader, NopWriteCloser. |
pkg/pools/ |
Reusable bufio pools. |
pkg/tailfile/ |
Tail-N-lines helper used by log drivers. |
pkg/longpath/ |
Windows \\?\ long-path helper. |
pkg/homedir/ |
Locate the user's home directory cross-platform. |
pkg/useragent/ |
Build the daemon's User-Agent string. |
Where utilities went
A number of one-time pkg/ packages have been promoted to standalone repos. They still appear in go.mod as e.g.:
github.com/moby/sys/{mount,signal,user,reexec,...}github.com/moby/termgithub.com/moby/lockergithub.com/moby/patternmatchergithub.com/moby/pubsubgithub.com/moby/go-archive
The intent is that pkg/ shrinks over time. The remaining packages are mostly daemon-coupled (authorization, plugins) or low-level OS detection.
Stability
Even though pkg/ predates the module split, none of these packages have an API stability guarantee for the root module. External code that depends on them does so at its own risk. The README puts it bluntly: "Get in touch if you want to help maintain them."
See also
daemon/internal/— the modern home for utilities.- Plugins for
pkg/authorizationandpkg/plugins.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.