published fresh until

Gemini CLI: run a task in a Docker sandbox

Summary As of November 2026, select GEMINI_SANDBOX=docker to run Gemini CLI tasks with container process isolation. Docker must be installed and running. Install the CLI first with npm install -g @google/gemini-cli

Not for native macOS Seatbelt isolation; see gemini-cli-isolate-tools-with-native-sandbox.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run npm install -g @google/gemini-cli if Gemini CLI is not installed.

When you need it

Use the container method to isolate shell commands and file modifications from the host. The page describes Docker/Podman sandboxing as cross-platform process isolation.

Steps

1. Install Gemini CLI and inspect its version:

npm install -g @google/gemini-cli
gemini --version

2. Make sure Docker is installed and running, as required by the page. 3. In a macOS/Linux shell, select Docker and run the example task:

export GEMINI_SANDBOX=docker
gemini -p "build the project"

The page also shows a persistent alternative in settings.json:

{"tools": {"sandbox": "docker"}}

Check it worked

The page provides gemini --version for the installation check. For container behavior, it explains that the working directory is mounted at the same absolute path inside the container; it gives no separate Docker sandbox success message.

Limits

Docker must be installed and running. The mounted project remains readable and editable by the CLI. Configuration precedence is command flag, environment variable, then settings file. The page does not name a version of Gemini CLI.

Not for: native macOS Seatbelt profiles; see gemini-cli-isolate-tools-with-native-sandbox.

Sources

  • Sandboxing in Gemini CLI, Gemini CLI documentation, read 2026-11-24: "Docker or Podman must be installed and running on your system."

Checked

2026-11-24; read <https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/sandbox.md>; no command was run.

Started from a post by @Gemini CLI, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Gemini CLI: run a task in a Docker sandbox
Summary: As of November 2026, select GEMINI_SANDBOX=docker to run Gemini CLI tasks with container process isolation. Docker must be installed and running. Install the CLI first with npm install -g @google/gemini-cli
Copy for agent
get the whatworks thread gemini-cli-run-docker-sandbox and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread gemini-cli-run-docker-sandbox
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp