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
The Podman driver runs sandboxes as rootless containers through the user Podman socket, and Sandbox Runtimes lists its requirements. The commands in this section assume rootless Podman. Enable the socket for your user:
Running the gateway as a rootless Podman container needs five settings beyond the Docker commands above:
-
Writable state directory. The image runs as user
1000and cannot write to its default home directory. Mount a host directory, setHOMEandXDG_DATA_HOMEto it, and add--userns=keep-id:uid=1000,gid=1000so the container can read and write it. -
Same-path data directory. The driver bind-mounts files from the data directory into each sandbox, and the host Podman resolves the path on the host. Mount the directory at the same absolute path inside the container. A named volume does not work.
-
Signing keys and TLS certificates. Generate them with
generate-certsand setOPENSHELL_LOCAL_TLS_DIRto the output directory. The gateway then serves HTTPS and requires client certificates. -
SELinux type. On SELinux hosts, add
--security-opt label=type:container_runtime_t. Without it, the container cannot read the data directory or connect to the Podman socket. Podman ignores the option on other hosts. The gateway can start containers as your user through that socket, so run only the published gateway image. -
Matching ports. Supervisor containers call back to
127.0.0.1on the gateway’s in-container port. Publish the same port number on the host, or setgrpc_endpointas described below.
Generate the keys and certificates:
Start the gateway:
If the gateway container exits at startup with --tls-cert is required when TLS is enabled, the gateway cannot read its certificates. OPENSHELL_LOCAL_TLS_DIR is unset, or it points at a directory that is empty or that the container cannot read. Run generate-certs, set the variable, and check --userns=keep-id:uid=1000,gid=1000 and, on SELinux hosts, --security-opt label=type:container_runtime_t. Disabling TLS, as the error message suggests, would remove authentication.
The gateway takes a few seconds to start listening. Register it with the CLI and confirm the connection:
The CLI imports its client certificates from OPENSHELL_LOCAL_TLS_DIR. Without it, the CLI reads ~/.local/state/openshell/tls, which can hold another gateway’s certificates and fails with BadSignature. If a gateway named local is already registered, run openshell gateway remove local first.
To publish a different host port, set grpc_endpoint to the host address under [openshell.drivers.podman] in a gateway TOML file. For example, with -p 127.0.0.1:9090:8080, the file needs only version = 2 under [openshell] and grpc_endpoint = "https://127.0.0.1:9090". Save it as $data_dir/gateway.toml, add -e OPENSHELL_GATEWAY_CONFIG="$data_dir/gateway.toml" to the gateway command, and register the gateway at https://127.0.0.1:9090. The gateway configuration reference lists the other Podman options.
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.