Feature: dial registries over a Unix domain socket via hosts.toml (dial_addr)
Problem / motivation
At Runpod we operate a "neocloud" GPU platform. Like much of the industry right now, a large share of our workloads are agentic, and we lean heavily on sandboxing to isolate and secure those agents. Security posture is one of our primary concerns as an operator, and a concrete part of that work is minimizing the number of exposed TCP sockets on a host wherever it makes sense — every loopback listener is attack surface and one more thing to reason about in our threat model.
Runpod runs several container orchestration systems, and containerd sits under much of that stack. As part of tightening things down we run a local registry proxy/cache on each node and wanted containerd to reach it over a Unix domain socket instead of a 127.0.0.1:<port> TCP listener. A UDS keeps the registry-pull IPC entirely on-host, off the network stack, and lets us enforce access with filesystem permissions rather than a bound port.
This isn't the first containerd stack where I've reached for UDS. Previously at Siden.io, a video-streaming startup, we ran k3s (which embeds containerd) on lower-powered, RAM-constrained edge devices. There we used Unix domain sockets for inter-container communication precisely because they hit three goals at once for that environment: a tighter security posture (no network-exposed listeners), better performance (no TCP/loopback overhead), and lower resource usage — which matters a great deal when you're squeezing into constrained edge hardware. So this is a pattern I've now wanted in two independent containerd-based deployments with quite different constraints.
When we reached for this, we were surprised to find that this fairly fundamental IPC primitive isn't available for containerd's registry dialing. UDS support is otherwise ubiquitous — PostgreSQL, most long-running Unix daemons, and countless tools have offered it alongside TCP for years — and both Linux and Go's standard library have excellent, mature UDS support. So enabling it here looked like a small, natural addition rather than a new capability that has to be invented.
Current behavior
hosts.toml host entries are addressed by a URL whose host/port is dialed over TCP. There is no way to point a host entry at a Unix socket, so a local registry proxy/cache must expose a TCP listener (typically on loopback) for containerd to connect to.
Proposed solution
Add an optional per-host dial_addr field to hosts.toml that, when set, dials a Unix socket instead of the host's TCP address:
[host."https://registry.example"]
capabilities = ["pull", "resolve"]
dial_addr = "unix:///run/registry-proxy.sock"Design notes (as implemented in the PR below):
- Accepted forms:
unix:///path(pathname socket; on Windows the URL formunix:///C:/path/to.sockis converted to a native path before dialing) andunix://@name(Linux abstract socket; the syntax is accepted everywhere and surfaces a dial-time error on platforms that don't service it). - Works with both
http://andhttps://host entries — forhttps://the TLS handshake still runs over the socket against the configured host name, so certificate verification is unchanged. - Composes with the existing
dial_timeout, and clears the transport's proxy soHTTP(S)_PROXYfrom the environment can never reroute adial_addrhost. - Misconfiguration is rejected at parse time (non-
unixscheme, query string, fragment, trailing-slash pathname, empty abstract name, and a native path over the platform'ssun_pathlimit).
Alternatives considered
- Keep a loopback TCP listener. Works today, but it's exactly the exposed socket we're trying to eliminate, and it relies on port-level rather than filesystem-level access control.
- Front the socket with a userspace TCP↔UDS shim. Adds a process and a hop purely to work around a missing config field.
Additional context
I've already opened a PR implementing this, with cross-platform handling, docs (docs/hosts.md), and table-driven parser/resolver tests: #13569. Happy to move the design discussion here and adjust the approach — opening this issue per the containerd contribution guidelines so the use case and design are captured before merging.
Source: containerd/containerd