-
Notifications
You must be signed in to change notification settings - Fork 721
docs(container-gateway): fix Docker driver setup for containerized gateway #1419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ericcurtin
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
ericcurtin:docs-container-gateway-docker-driver/ec
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # OpenShell gateway — docker-compose setup (Docker compute driver) | ||
| # | ||
| # Prerequisites: | ||
| # - Docker Desktop (Windows / macOS) or Docker Engine + Compose plugin (Linux) | ||
| # - The openshell CLI installed on your workstation | ||
| # | ||
| # Quick start: | ||
| # | ||
| # 1. Start the gateway: | ||
| # docker compose up -d | ||
| # | ||
| # 2. Register the gateway with the CLI (one-time): | ||
| # openshell gateway add openshell-docker \ | ||
| # --endpoint http://localhost:18080 \ | ||
| # --no-tls | ||
| # | ||
| # 3. Configure an AI provider (example: Anthropic): | ||
| # ANTHROPIC_API_KEY=sk-ant-... \ | ||
| # openshell provider create --type anthropic --from-existing | ||
| # | ||
| # 4. Create a sandboxed agent — Claude Code or OpenClaw: | ||
| # openshell sandbox create -- claude | ||
| # openshell sandbox create --from openclaw | ||
| # | ||
| # Sandbox containers are managed by the gateway, not by this Compose file. | ||
| # Each `openshell sandbox create` call launches a fresh container; the gateway | ||
| # tracks their lifecycle. | ||
| # | ||
| # Configuration: | ||
| # All gateway settings below use OPENSHELL_* environment variables. | ||
| # The gateway binary reads these directly, so no separate config file | ||
| # is required. See `docker run --rm ghcr.io/nvidia/openshell/gateway:latest | ||
| # --help` for the full list of supported variables. | ||
| # | ||
| # The dev image (ghcr.io/nvidia/openshell/gateway:dev) also supports a | ||
| # TOML configuration file via --config / OPENSHELL_GATEWAY_CONFIG. | ||
| # See gateway.toml in this directory for an equivalent TOML reference. | ||
| # | ||
| # Data directory note: | ||
| # /var/lib/openshell is bind-mounted at the SAME absolute path in both the | ||
| # host and the container. This is required so that the supervisor binary | ||
| # extracted from the supervisor image can be passed to Docker as a host-side | ||
| # bind-mount source when sandbox containers are created. Named volumes | ||
| # cannot be used here because Docker resolves bind-mount sources against the | ||
| # host filesystem, not the container filesystem. | ||
| # | ||
| # Linux note: | ||
| # host.docker.internal is not automatically added on Linux Docker. | ||
| # Add the following under the gateway service to enable it: | ||
| # extra_hosts: | ||
| # - "host.docker.internal:host-gateway" | ||
|
|
||
| services: | ||
| gateway: | ||
| image: ghcr.io/nvidia/openshell/gateway:${IMAGE_TAG:-latest} | ||
| restart: unless-stopped | ||
|
|
||
| # This setup is Docker-outside-of-Docker (DooD), not Docker-in-Docker (DinD). | ||
| # The gateway uses the host's Docker socket to create sibling containers on the | ||
| # host, rather than running a nested Docker daemon. DooD does NOT require | ||
| # --privileged; it only needs read/write access to /var/run/docker.sock. | ||
| # | ||
| # Run as UID 0 so the gateway can: | ||
| # - write the extracted supervisor binary to /var/lib/openshell | ||
| # - access /var/run/docker.sock (typically owned by root or the docker group) | ||
| # Distroless images have no /etc/passwd, so the numeric UID must be used. | ||
| # This is appropriate for local development. Production deployments | ||
| # should use a dedicated non-root UID with explicit docker-group membership. | ||
| user: "0" | ||
|
|
||
| ports: | ||
| # gRPC / control-plane API (used by the openshell CLI and sandbox callbacks) | ||
| # The Docker driver injects host.openshell.internal:<gateway-port> into sandbox | ||
| # containers as the callback endpoint. The gateway's internal port is 8080, so | ||
| # host port 8080 must be published at the same number so that | ||
| # host.openshell.internal:8080 routes to the gateway container. | ||
| - "${OPENSHELL_PORT:-8080}:8080" | ||
| # Health endpoint (GET /healthz, GET /readyz) | ||
| - "${OPENSHELL_HEALTH_PORT:-8081}:8081" | ||
|
|
||
| volumes: | ||
| # Docker socket — lets the gateway create and manage sandbox containers. | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
|
|
||
| # Data directory — must be a bind-mount with source == target so that | ||
| # paths written inside the container are resolvable by Docker when it | ||
| # creates sandbox containers (see note above). | ||
| # /var/lib/openshell is intentionally not namespaced to a sub-path | ||
| # (e.g. /var/lib/openshell/gateway): the path must match exactly on | ||
| # both the host and inside the container, and a single gateway per host | ||
| # is the expected topology. | ||
| - type: bind | ||
| source: /var/lib/openshell | ||
| target: /var/lib/openshell | ||
|
ericcurtin marked this conversation as resolved.
|
||
| bind: | ||
| create_host_path: true | ||
|
|
||
| environment: | ||
| # ── Listener ─────────────────────────────────────────────────────────── | ||
| # bind-address is already set to 0.0.0.0 by the image's default CMD; | ||
| # these vars configure the remaining listener ports. | ||
| OPENSHELL_HEALTH_PORT: "8081" | ||
|
|
||
| # ── Auth / TLS ────────────────────────────────────────────────────────── | ||
| OPENSHELL_DISABLE_TLS: "true" | ||
|
|
||
| # ── Compute driver ───────────────────────────────────────────────────── | ||
| OPENSHELL_DRIVERS: "docker" | ||
|
|
||
| # ── Sandbox defaults ──────────────────────────────────────────────────── | ||
| # Default image used when --from is not specified. | ||
| OPENSHELL_SANDBOX_IMAGE: "ghcr.io/nvidia/openshell-community/sandboxes/base:latest" | ||
|
|
||
| # ── Docker driver ─────────────────────────────────────────────────────── | ||
| # Supervisor image used to extract the openshell-sandbox binary on first | ||
| # start. The binary is cached in /var/lib/openshell and reused on | ||
| # subsequent starts. | ||
| OPENSHELL_DOCKER_SUPERVISOR_IMAGE: "ghcr.io/nvidia/openshell/supervisor:latest" | ||
|
|
||
| # Address sandbox containers use to call back to this gateway. | ||
| # The Docker driver always substitutes host.openshell.internal and the | ||
| # gateway bind port into this URL, so only the scheme (http/https) is | ||
| # meaningful here. The gateway must be published on the same port number | ||
| # on the Docker host (port 8080 by default — see ports above). | ||
| OPENSHELL_GRPC_ENDPOINT: "http://host.openshell.internal:8080" | ||
|
|
||
| # ── Persistence ──────────────────────────────────────────────────────── | ||
| OPENSHELL_DB_URL: "sqlite:/var/lib/openshell/gateway.db?mode=rwc" | ||
|
|
||
| # ── XDG paths ────────────────────────────────────────────────────────── | ||
| # Point XDG data home at the bind-mounted data directory so the | ||
| # extracted supervisor binary lands at a host-resolvable path. | ||
| XDG_DATA_HOME: /var/lib/openshell | ||
| HOME: /var/lib/openshell | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # OpenShell gateway TOML configuration — Docker compute driver reference. | ||
| # | ||
| # This file is the TOML equivalent of the OPENSHELL_* environment variables | ||
| # set in docker-compose.yml. It requires the dev image or a release that | ||
| # includes RFC 0003 config-file support (post-0.0.42). | ||
| # | ||
| # To use this file with docker-compose, switch the image to the dev tag and | ||
| # replace the environment section with a config file mount: | ||
| # | ||
| # services: | ||
| # gateway: | ||
| # image: ghcr.io/nvidia/openshell/gateway:dev | ||
| # volumes: | ||
| # - type: bind | ||
| # source: ./gateway.toml | ||
| # target: /etc/openshell/gateway.toml | ||
| # read_only: true | ||
| # environment: | ||
| # OPENSHELL_GATEWAY_CONFIG: /etc/openshell/gateway.toml | ||
| # XDG_DATA_HOME: /var/lib/openshell | ||
| # HOME: /var/lib/openshell | ||
| # command: [] # clear the default CMD; config drives everything | ||
| # | ||
| # grpc_endpoint note: | ||
| # host.docker.internal is automatically resolvable from containers on | ||
| # Docker Desktop (Windows / macOS). On Linux, replace with the host IP | ||
| # or add extra_hosts: ["host.docker.internal:host-gateway"] to compose. | ||
|
|
||
| [openshell] | ||
| version = 1 | ||
|
|
||
| [openshell.gateway] | ||
| # Bind to loopback only. The Docker driver adds an extra listener on the | ||
| # bridge interface automatically so sandbox containers can reach the gateway. | ||
| bind_address = "127.0.0.1:8080" | ||
| health_bind_address = "127.0.0.1:8081" | ||
| log_level = "info" | ||
| compute_drivers = ["docker"] | ||
| disable_tls = true | ||
|
|
||
| [openshell.drivers.docker] | ||
| # Default image pulled for `openshell sandbox create` without --from. | ||
| default_image = "ghcr.io/nvidia/openshell-community/sandboxes/base:latest" | ||
| # Supervisor image from which the openshell-sandbox binary is extracted on | ||
| # first start. The binary is cached to XDG_DATA_HOME and reused on restart. | ||
| supervisor_image = "ghcr.io/nvidia/openshell/supervisor:latest" | ||
| # Only pull images that are not already cached locally. | ||
| image_pull_policy = "IfNotPresent" | ||
| # Prefix applied to sandbox container names. | ||
| sandbox_namespace = "openshell" | ||
| # Address sandbox containers use to call back to the gateway. | ||
| # The Docker driver replaces the host with host.openshell.internal and the | ||
| # port with the gateway's own bind port (8080). Only the scheme survives. | ||
| # The gateway must be published on port 8080 on the Docker host so that | ||
| # host.openshell.internal:8080 resolves to the gateway container. | ||
| grpc_endpoint = "http://host.openshell.internal:8080" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.