Gemini CLI Sandbox Template

May 1, 2026 ยท View on GitHub

Run Gemini CLI in a network-locked container. All outbound traffic is routed through an enforcing proxy that applies the project's network policy.

See the main README for installation, architecture overview, and configuration options.

Setup

After running agentbox init (selecting "gemini") and starting the sandbox, authenticate Gemini on first run.

Authenticate Gemini (first run only)

Two authentication methods are supported:

API key (simplest): Set the GEMINI_API_KEY environment variable before starting the container, or export it inside the container shell.

Google OAuth: Run gemini inside the container. On first run it will display a URL for browser-based authentication. Complete the flow in your browser.

Credentials persist in a Docker volume. You only need to do this once per project.

Use Gemini CLI

Inside the container:

gemini
# or auto-approve mode:
gemini --approval-mode=yolo

Afterward, for CLI mode, stop the container:

agentbox compose down

Terminal vs IDE Extension

You can run Gemini CLI two ways within the container:

ModeHow to startIDE support
TerminalRun gemini in the integrated terminalVS Code, JetBrains
IDE extensiondevcontainer.json should install the extension automaticallyVS Code

VS Code

In VS Code, both modes work with the sandbox container. The IDE extension runs inside the container and respects the HTTP_PROXY environment variable. The extension is automatically installed when using the devcontainer.