|
| 1 | +# First Run / 首次运行 |
| 2 | + |
| 3 | +SSH access is initialized at runtime. Provide an OpenSSH public key through `SSH_PUB_KEY` on the first start; the entrypoint validates it and stores it in the persistent `dsh-data` volume. Never pass a private key, token, or other secret through this variable. |
| 4 | + |
| 5 | +SSH 访问在运行时初始化。首次启动时通过 `SSH_PUB_KEY` 提供 OpenSSH 公钥;入口脚本验证后将其保存在持久化的 `dsh-data` 卷中。不要通过该变量传入私钥、token 或其他秘密。 |
| 6 | + |
| 7 | +## Start with Compose / 使用 Compose 启动 |
| 8 | + |
| 9 | +Install the AppArmor profile, create the workspace, then build and start: |
| 10 | + |
| 11 | +安装 AppArmor 配置、创建工作区,然后构建并启动: |
| 12 | + |
| 13 | +```sh |
| 14 | +sudo install -m 0644 build/deepseek-harness /etc/apparmor.d/deepseek-harness |
| 15 | +sudo apparmor_parser -r /etc/apparmor.d/deepseek-harness |
| 16 | +mkdir -p workspace |
| 17 | +SSH_PUB_KEY="$(cat ~/.ssh/id_ed25519.pub)" docker compose up -d --build |
| 18 | +``` |
| 19 | + |
| 20 | +After initialization, ordinary starts need no key variable: |
| 21 | + |
| 22 | +初始化完成后,普通启动无需再次提供公钥变量: |
| 23 | + |
| 24 | +```sh |
| 25 | +docker compose up -d |
| 26 | +``` |
| 27 | + |
| 28 | +## Start a Published Image / 启动已发布镜像 |
| 29 | + |
| 30 | +Replace the example `DSH_IMAGE` value with the registry image name. The AppArmor profile must already be installed from this repository. |
| 31 | + |
| 32 | +将示例中的 `DSH_IMAGE` 值替换为镜像仓库中的实际名称;宿主机必须已经从本仓库安装 AppArmor 配置。 |
| 33 | + |
| 34 | +```sh |
| 35 | +export DSH_IMAGE=ghcr.io/owner/image:tag |
| 36 | +docker pull "${DSH_IMAGE}" |
| 37 | +mkdir -p workspace |
| 38 | +docker volume create dsh-data |
| 39 | +docker run -d \ |
| 40 | + --name deepseek-harness \ |
| 41 | + --hostname dsh-dev \ |
| 42 | + --restart unless-stopped \ |
| 43 | + --pids-limit 1024 \ |
| 44 | + --userns=host \ |
| 45 | + --security-opt apparmor=deepseek-harness \ |
| 46 | + --security-opt seccomp=unconfined \ |
| 47 | + -p 127.0.0.1:3080:3081 \ |
| 48 | + -p 127.0.0.1:2222:2222 \ |
| 49 | + --mount source=dsh-data,target=/data/dsh \ |
| 50 | + --mount type=bind,source="$(pwd)/workspace",target=/home/developer/workspace \ |
| 51 | + -e SSH_PUB_KEY="$(cat ~/.ssh/id_ed25519.pub)" \ |
| 52 | + "${DSH_IMAGE}" |
| 53 | +``` |
| 54 | + |
| 55 | +Open `http://127.0.0.1:3080` or connect with: |
| 56 | + |
| 57 | +访问 `http://127.0.0.1:3080`,或通过 SSH 连接: |
| 58 | + |
| 59 | +```sh |
| 60 | +ssh -i ~/.ssh/id_ed25519 -p 2222 developer@127.0.0.1 |
| 61 | +``` |
| 62 | + |
| 63 | +To rotate the key with Compose, provide a new value while recreating the container: |
| 64 | + |
| 65 | +如需通过 Compose 轮换公钥,在重建容器时提供新值: |
| 66 | + |
| 67 | +```sh |
| 68 | +SSH_PUB_KEY="$(cat ~/.ssh/new_key.pub)" docker compose up -d --force-recreate |
| 69 | +``` |
| 70 | + |
| 71 | +Deleting `dsh-data` also deletes the stored SSH key. The next start must provide `SSH_PUB_KEY` again. A missing or invalid first-run key causes the container to stop with an explanatory log message. |
| 72 | + |
| 73 | +删除 `dsh-data` 也会删除已保存的 SSH 公钥。下次启动必须重新提供 `SSH_PUB_KEY`;首次运行时缺少公钥或格式无效会使容器停止,并在日志中给出原因。 |
0 commit comments