DeepSeekDSH
中文GitHub
Menu
Independent community guideNot affiliated with DeepSeek.Download versions and guide references

Run DeepSeek Harness (DSH) in Docker & Docker Compose

Isolate DeepSeek Harness inside a Node.js 24 container with persistent DSH_HOME storage and safe loopback-only access over SSH.

On this page
Quick summary: who this guide is for

Best for Linux servers, NAS hosts, and isolated workspaces. You need Docker Compose and a DeepSeek API key; the 3 steps below run DSH on Node 24 without touching your host Node installation.

Three reasons to run DSH in Docker

DeepSeek Harness edits files and runs shell commands inside the workspace you select. A container keeps the runtime, project directory, and credentials cleanly separated:

Pinned Node.js 24

The official node:24-slim image satisfies DSH 0.2.2 and 0.2.3-alpha requirements without changing your host Node version.

Workspace sandboxing

Only the specific directory bind-mounted to /workspace is visible inside the container.

Persistent state

Mounting DSH_HOME to a named volume keeps credentials, profiles, and session logs intact across rebuilds.

Pick the right setup for your OS

The current DSH CLI web entry binds strictly to 127.0.0.1 and does not support --host 0.0.0.0. Choose the matching route before starting:

EnvironmentRecommended setupHow to open Web UI
Linux server / NASDocker + network_mode: hostSSH port forward to 127.0.0.1:3080
macOS / Windows laptopNative DSH Desktop appLaunch the app directly—no bridge proxy needed
Docker Desktop bridgeAuthenticated Caddy/Nginx sidecarProxy to container loopback 127.0.0.1:3080
Step 1

Create a minimal Dockerfile

Save this Dockerfile in an empty folder. It installs the latest DSH CLI with pnpm support and runs as the non-root node user:

FROM node:24-slim

RUN apt-get update && apt-get install -y --no-install-recommends
git ca-certificates curl
&& rm -rf /var/lib/apt/lists/*

RUN corepack enable && npm install -g @deepseek-ai/dsh@latest

ENV DSH_HOME=/data/dsh-home
NO_PROXY=127.0.0.1,localhost,::1

RUN mkdir -p /data/dsh-home /workspace && chown -R node:node /data/dsh-home /workspace USER node WORKDIR /workspace

CMD ["dsh", "web", "--no-open", "--port", "3080"]

Never bake API keys into the image

Pass DEEPSEEK_API_KEY at runtime via environment variables or save credentials inside the mounted DSH_HOME volume.

Step 2

Launch with Docker Compose

Save this compose.yml next to your Dockerfile, pointing ./workspace to the dedicated folder you want DSH to access:

services: dsh: build: . container_name: deepseek-harness restart: unless-stopped network_mode: host environment: - DSH_HOME=/data/dsh-home - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY} - NO_PROXY=127.0.0.1,localhost,::1 volumes: - dsh_home:/data/dsh-home - ./workspace:/workspace

volumes: dsh_home:

Build and start the container, then watch the startup logs until port 3080 is ready:

mkdir -p ./workspace export DEEPSEEK_API_KEY="sk-your-key" docker compose up -d --build docker compose logs -f dsh
Step 3

Open port 3080 safely over SSH

Once logs show the local URL, connect from your laptop in three quick steps:

  1. 01

    Start an SSH tunnel

    Run ssh -L 3080:127.0.0.1:3080 user@your-server on your laptop to forward remote loopback port 3080 securely.

  2. 02

    Open the local Web UI

    Visit http://127.0.0.1:3080 in your browser to reach the containerized DSH session.

  3. 03

    Complete first-run readiness

    Confirm your provider key, click Choose workspace to select /workspace, and pick a model to send your first prompt.

Do not expose port 3080 to the public internet

DSH can read files and run shell commands inside its mounted workspace. Always keep it behind SSH forwarding, a private VPN (such as Tailscale), or an authenticated reverse proxy.

Sandbox and proxy checklist

Separate state from code

Never place DSH_HOME inside ./workspace so .credentials.yaml is never committed to Git.

Fix Linux mount permissions

If ./workspace hits Permission denied, match its ownership to the container node UID (default 1000).

Bypass proxy for loopback

Pass HTTP_PROXY and NODE_USE_ENV_PROXY=1 when required, and keep NO_PROXY for local traffic. See the proxy guide.

Docker troubleshooting FAQ

Why does localhost:3080 fail with ports: 3080:3080?

dsh web listens only on 127.0.0.1 inside the container and does not support --host 0.0.0.0. Use network_mode: host with SSH forwarding on Linux.

How do I upgrade DSH inside Docker?

Run docker compose build --no-cache && docker compose up -d. Your credentials and session logs stay preserved in the dsh_home volume (back it up before major upgrades).

Can I run headless tasks in Docker without the Web UI?

Yes. Run docker compose run --rm dsh dsh --profile headless ... for scripted tasks in the isolated workspace. See the Headless mode guide.

NEXT STEPNeed host-native Linux setup or port troubleshooting?
Linux installation guide →
Sources & scope

Node.js baselines and CLI loopback behavior follow the DSH CLI behavior reference and release notes, checked .