@north-light/env-docker

中文文档
0.3.573发布于 2026/11/02UNLICENSEDTypeScriptESM + CJS零依赖

Docker connection manager for the crouter SDK — start, attach to, and stop a crtrd container over the docker CLI. Zero crouter imports.

原始使用文档
文档目录5 节
  1. Install
  2. Start a container
  3. Attach to an existing container
  4. Related
  5. License

@north-light/env-docker — start and attach to a crtrd container from Node

crouter

npm

@north-light/env-docker starts, attaches to and stops a crtrd (the crouter daemon) Docker container through the docker CLI, and hands back the connection settings that @north-light/sdk takes. It has no dependencies, including on the SDK.

It is not a Docker client library or an orchestrator: it runs one container and tells you how to reach it. The image contains no model credential, so you configure a provider inside the container before an agent run can do anything.

Docs · SDK · crouter repository · Source

Install

npm install @north-light/env-docker @north-light/sdk

The Docker CLI must be on PATH, and able to pull ghcr.io/northlight-systems/crtrd (or the image you pass).

Start a container

import { start } from '@north-light/env-docker';
import Crouter from '@north-light/sdk';

const env = await start({
  name: 'my-crouter',
  volume: 'my-agent-home',
});

const client = new Crouter(env.connection());
console.log(await client.system.health());

await env.stop();

start() creates a container from ghcr.io/northlight-systems/crtrd:latest unless you pass image, generates a bearer token, grants the privileges the image's sandbox launcher needs (SYS_ADMIN and NET_ADMIN, unconfined seccomp and AppArmor), binds the mapped port to 127.0.0.1, and waits for /healthz. connection() returns { baseURL, headers }, the shape new Crouter(...) takes. stop() removes the container.

Options: env sets container environment variables, port selects a host port, volume mounts a named Docker volume at /volume, the image's declared volume. A named volume keeps canvas state, memory and installed credentials when the container is recreated.

Attach to an existing container

import { attach } from '@north-light/env-docker';

const env = await attach('my-crouter');
const connection = env.connection();
await env.stop(); // stops the container but does not remove it

attach(name) reads the container's mapped port and its CRTRD_TOKEN.

License

Proprietary. Copyright (c) 2026 Northlight Systems. All rights reserved. See LICENSE.

版本与发布记录

@north-light/env-docker 共发布 161 个版本,首次发布于 2026/10/10;过去 12 个月发布了 161 个版本。

版本发布日期距今
0.3.573latest2026/11/021 天前
0.3.5722026/11/021 天前
0.3.5712026/11/021 天前
0.3.5702026/11/021 天前
0.3.5692026/11/012 天前
0.3.5682026/11/012 天前

关于 @north-light/env-docker 的常见问题

@north-light/env-docker 是什么?

用于路由器SDK的Docker连接管理器-通过Docker CLI启动,连接和停止crtrd容器。零路由器导入。

如何安装 @north-light/env-docker?

在项目目录运行 npm install @north-light/env-docker,或使用 pnpm add / yarn add / bun add。

@north-light/env-docker 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@north-light/env-docker 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@north-light/env-docker 可以商用吗?

@north-light/env-docker 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@north-light/env-docker 还在维护吗?

最新版本 0.3.573 发布于 2026/11/02(1 天前);至今共发布 161 个版本,其中过去 12 个月发布了 161 个;首次发布于 2026/10/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。