mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 07:21:23 +00:00
feat(sandbox): separate bind mounts for browser containers (#16230)
* feat(sandbox): add separate browser.binds config for browser containers Allow configuring bind mounts independently for browser containers via sandbox.browser.binds. When set, browser containers use browser-specific binds instead of inheriting docker.binds. Falls back to docker.binds when browser.binds is not configured for backwards compatibility. Closes #14614 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(sandbox): honor empty browser binds override (#16230) (thanks @seheepeak) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -106,9 +106,13 @@ export async function ensureSandboxBrowser(params: {
|
||||
const state = await dockerContainerState(containerName);
|
||||
if (!state.exists) {
|
||||
await ensureSandboxBrowserImage(params.cfg.browser.image ?? DEFAULT_SANDBOX_BROWSER_IMAGE);
|
||||
const browserDockerCfg =
|
||||
params.cfg.browser.binds !== undefined
|
||||
? { ...params.cfg.docker, network: "bridge", binds: params.cfg.browser.binds }
|
||||
: { ...params.cfg.docker, network: "bridge" };
|
||||
const args = buildSandboxCreateArgs({
|
||||
name: containerName,
|
||||
cfg: { ...params.cfg.docker, network: "bridge" },
|
||||
cfg: browserDockerCfg,
|
||||
scopeKey: params.scopeKey,
|
||||
labels: { "openclaw.sandboxBrowser": "1" },
|
||||
});
|
||||
|
||||
@@ -88,6 +88,9 @@ export function resolveSandboxBrowserConfig(params: {
|
||||
}): SandboxBrowserConfig {
|
||||
const agentBrowser = params.scope === "shared" ? undefined : params.agentBrowser;
|
||||
const globalBrowser = params.globalBrowser;
|
||||
const binds = [...(globalBrowser?.binds ?? []), ...(agentBrowser?.binds ?? [])];
|
||||
// Treat `binds: []` as an explicit override, so it can disable `docker.binds` for the browser container.
|
||||
const bindsConfigured = globalBrowser?.binds !== undefined || agentBrowser?.binds !== undefined;
|
||||
return {
|
||||
enabled: agentBrowser?.enabled ?? globalBrowser?.enabled ?? false,
|
||||
image: agentBrowser?.image ?? globalBrowser?.image ?? DEFAULT_SANDBOX_BROWSER_IMAGE,
|
||||
@@ -107,6 +110,7 @@ export function resolveSandboxBrowserConfig(params: {
|
||||
agentBrowser?.autoStartTimeoutMs ??
|
||||
globalBrowser?.autoStartTimeoutMs ??
|
||||
DEFAULT_SANDBOX_BROWSER_AUTOSTART_TIMEOUT_MS,
|
||||
binds: bindsConfigured ? binds : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ export type SandboxBrowserConfig = {
|
||||
allowHostControl: boolean;
|
||||
autoStart: boolean;
|
||||
autoStartTimeoutMs: number;
|
||||
binds?: string[];
|
||||
};
|
||||
|
||||
export type SandboxPruneConfig = {
|
||||
|
||||
Reference in New Issue
Block a user