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