Skip to content

cliExtension

cliExtension(manager, opts?): Extension

Defined in: packages/runtime/src/container/cli-extension.ts:344

Container CLI Extension for the root container.

ContainerManager

The ContainerManager instance (created at boot time).

CliExtensionOpts

Optional configuration; see CliExtensionOpts.

Extension

An Extension suitable for Unix().use(...) on the root container.

What this registers:

  • Bins: container — single dispatcher that routes run, stop, drain, restart, rm, ps, kill, wait, exec, attach, logs, inspect, nsenter, unshare, help. help — standalone /lib/help/ reader.
  • Mounts: /dev/container — a containerFS instance bound to manager, opts.resolver, opts.selfInfo, and opts.auditLoggers.
  • Files: /lib/help/container, /lib/help/container-run, /lib/help/container-stop, /lib/help/container-drain, /lib/help/container-restart, /lib/help/container-rm, /lib/help/container-ps, /lib/help/container-kill, /lib/help/container-wait, /lib/help/container-exec, /lib/help/container-attach, /lib/help/container-logs, /lib/help/container-inspect, /lib/help/container-unshare, /lib/help/container-nsenter — one-liner help stubs per subcommand.

All container operations go through container <cmd> to avoid shadowing coreutils names (rm, ps, kill, wait). This Extension is intended for the root container only; children do not inherit these bins — capability in child namespaces is defined by presence, not inheritance.

import { Unix } from '@fishnet/core'
import { cliExtension } from '@fishnet/runtime/container/cli-extension'
const sys = await Unix()
.use(cliExtension(manager, { resolver, image }))
.build()
.boot()
await sys.run('container run alpine --name web')