Skip to main content

Units

Mebibytes is a branded number, so memory: 512 does not compile and the unit has to be written at the call site. The mebibyte is the canonical unit — MiB(512) === 512 at runtime — and the others convert into it. JavaScript callers get the documentation value without the enforcement — the brand is erased at runtime.

SandboxError

One error type with a stable code to branch on, deliberately not a subclass hierarchy: callers want to know whether to retry, rebuild or give up, and that is decided by a string.
See errors for what to do about each code.

Constants

DEFAULT_IMAGES is frozen. Pass images to the constructor to change the mapping; anything unrecognised falls back to node.

SandboxInfo

What list() returns.
state is passed through from the engine rather than translated, because the vocabulary is the engine’s and inventing a parallel one hides what docker ps would tell you. exited is the ordinary stopped state.

Engine

The socket connection. Its constructor takes EngineOptions — a single optional socketPath, which SandboxesOptions also accepts and passes through. The socket connection. You should not need it — Sandboxes wraps everything this package does — but it is exported so you can make a call this package does not, against the same socket.
defaultSocketPath() is the resolution described in requirements: $DOCKER_HOST, then Podman’s per-user socket, then Docker’s.
Engine is the unwrapped API. Containers you create through it carry none of this package’s labels, so list(), sweep() and removeAll() will not see them — and nothing will reclaim them.