Running the Gateway as a Container
Use this approach when you want to run the OpenShell gateway as a container instead of installing it with the system package manager. This is useful on immutable OS distributions (Fedora CoreOS, bootc-based images, Silverblue) where the standard installer is not appropriate, or anywhere you prefer a container-first workflow.
The gateway image is published at ghcr.io/nvidia/openshell/gateway.
Prerequisites for the Docker Driver
When the gateway runs as a container and creates Docker-backed sandboxes, the gateway container
communicates with the host Docker daemon via the mounted socket. This requires three things beyond
a basic docker run:
-
Docker socket access. The gateway process must be able to read and write the Docker socket. Add the
dockergroup (or the GID of/var/run/docker.sock) so the socket is accessible without running as root. -
gRPC endpoint. Sandbox containers call back to the gateway over the
OPENSHELL_GRPC_ENDPOINTaddress. The Docker driver substituteshost.openshell.internalas the host and the gateway’s own bind port as the port — only the scheme (httporhttps) is preserved. Usehttp://host.openshell.internal:8080when TLS is disabled andhttps://host.openshell.internal:8080when mTLS is enabled. The docker driver automatically binds the gateway to the bridge network interface so sandbox containers can reach it — you do not need to expose the port on0.0.0.0. -
Supervisor binary on the host. The gateway bind-mounts the
openshell-sandboxsupervisor binary into each sandbox container. Because bind-mount paths are resolved by the host Docker daemon (not inside the gateway container), the binary must exist at a path on the host filesystem and be mounted at the same absolute path inside the gateway container. That way the path the gateway records internally matches what Docker can find on the host when it creates sandbox containers.
Quick Start
Extract the supervisor binary to the host once, then start the gateway:
Start the gateway:
The volume mount uses ~/openshell/supervisor/openshell-sandbox for both the host and container
paths. The shell expands ~ in both halves before passing the argument to Docker, so both sides
resolve to the same absolute path (e.g., /home/user/openshell/supervisor/openshell-sandbox).
This satisfies the same-path requirement so the host Docker daemon can find the binary when
creating sandbox containers.
Register the gateway with the CLI. If running on the same machine, use --local:
If registering from a different machine on the same network, use the host IP and --remote:
Confirm the CLI can reach the gateway:
Disabling TLS removes authentication. This example binds to 127.0.0.1 so only local
connections are accepted. To accept remote connections, enable mTLS or restrict access with
a firewall rule.
Full mTLS Setup
To run the gateway with mutual TLS, generate the PKI bundle first, then start the gateway with the cert paths configured.
Bootstrap the PKI into a local state directory:
This writes the server and client certificates under ~/.local/state/openshell/tls/, writes sandbox JWT signing keys under ~/.local/state/openshell/tls/jwt/, and copies the client bundle to ~/.config/openshell/gateways/openshell/mtls/ so the CLI picks it up automatically.
Start the gateway with mTLS enabled:
Register the gateway with mTLS:
Docker Compose
The deploy/docker/ directory in
the repository contains a production-ready Compose setup with full inline documentation:
Clone or copy those files, then start the gateway:
The init service runs first and writes the sandbox JWT signing keys to /var/lib/openshell/tls on the host. The Docker driver requires them, and existing keys are kept. Do not commit them. This setup disables TLS and user authentication and publishes the port on loopback only.
Register the gateway with the CLI. If registering from the same machine:
If registering from a different machine on the same network, replace HOST_IP with the
machine’s LAN address:
Enable mTLS
The init service already writes the server, client, and CA certificates to /var/lib/openshell/tls, so enabling mTLS only needs configuration changes:
-
In
gateway.toml, removedisable_tls = trueand the[openshell.gateway.auth]table. -
In
docker-compose.yml, addOPENSHELL_LOCAL_TLS_DIR: /var/lib/openshell/tlsunder thegatewayserviceenvironment. The gateway loads its server certificate, client CA, and sandbox client bundle from that directory, and turns on mTLS user authentication. -
Apply the change:
Then copy the client bundle to ~/.config/openshell/gateways/local/mtls/, where the CLI loads it (refer to Gateway Authentication). The files are owned by root, so copy them with sudo and hand them to your user. If you registered the plaintext gateway as local, run openshell gateway remove local first.
Using Podman
Replace docker with podman in the commands above. Mount the Podman socket instead of the Docker socket and set the driver to podman:
Next Steps
- To prepare an image and launch an agent, refer to Run Your First Agent.
- To control what the agent can access, refer to Policies.
- For environment variable reference, refer to Sandbox Runtimes.