
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
基于ssh2、socket.io、xterm.js和express的Web SSH客户端,提供HTML5网页终端模拟器和SSH客户端功能。通过在主机上使用SSH2作为客户端,将WebSocket/Socket.io连接代理到SSH2服务器,实现网页端SSH访问。
!WebSSH2 v0.2.0演示
WebSSH2 Docker镜像封装了Web SSH客户端应用,允许用户通过浏览器访问和管理SSH服务器。无需安装本地SSH客户端,只需通过网页即可建立SSH连接,适用于远程服务器管理、跨平台访问等场景。
billchurch/webssh2:latest:最新稳定版,对应官方最新发布版本billchurch/webssh2:<版本号>:指定版本,如0.4.6、0.4.7-alpha.2bash# 拉取最新稳定版 docker pull docker.xuanyuan.run/billchurch/webssh2 # 拉取指定版本 docker pull docker.xuanyuan.run/billchurch/webssh2:0.4.6
基本运行
bashdocker run --name webssh2 -d -p 2222:2222 docker.xuanyuan.run/billchurch/webssh2
挂载自定义配置文件
bash# 先准备配置文件(可从https://github.com/billchurch/webssh2/blob/0.4.6/app/config.json.sample获取模板) docker run --name webssh2 -d -p 2222:2222 -v $(pwd)/config.json:/usr/src/config.json docker.xuanyuan.run/billchurch/webssh2
构建本地镜像(如需修改源码)
bash# 克隆仓库 git clone https://github.com/billchurch/webssh2.git cd webssh2 git checkout current # 或指定版本标签 # 构建镜像 docker build -t webssh2 . # 运行本地镜像 docker run --name docker.xuanyuan.run/webssh2 -d -p 2222:2222 webssh2
环境变量会覆盖config.json中的对应配置,适用于容器化环境:
| 变量名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| LISTEN | string | 127.0.0.1 | 服务监听IP地址 |
| PORT | integer | 2222 | 服务监听端口 |
| SOCKETIO_ORIGINS | array | localhost:2222 | 允许的CORS源,使用*:*可允许所有(不推荐) |
| SOCKETIO_PATH | string | /ssh/socket.io | socket.io客户端文件路径 |
| SOCKETIO_SERVECLIENT | boolean | false | 是否提供socket.io客户端文件(通常不需要,内置在自定义JS中) |
通过POST请求传递连接参数:
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| username | string | - | SSH登录用户名 |
| userpassword | string | - | SSH登录密码 |
| port | integer | 22 | SSH服务器端口 |
| header | string | - | 页面显示的可选标题 |
| headerBackground | string | - | 标题背景颜色 |
| sshterm | string | vt100 | 终端模拟类型 |
| readyTimeout | integer | 20000 | SSH握手超时时间(毫秒) |
| cursorBlink | boolean | true | 光标是否闪烁 |
| scrollback | integer | *** | 回滚缓冲区行数 |
| tabStopWidth | integer | 8 | 制表符宽度 |
| bellStyle | string | sound | 终端提示音样式(sound/none) |
| fontSize | number | 12 | 字体大小 |
| fontFamily | string | - | 字体家族 |
| letterSpacing | number | - | 字符间距 |
| lineHeight | number | - | 行高 |
通过URL查询参数传递连接参数(与POST参数类似):
示例:http://localhost:2222/ssh/host/192.168.1.1?port=2244&header=My%20Header&headerBackground=red
配置文件包含详细自定义选项,JSON格式:
json{ "listen": { "ip": "127.0.0.1", "port": 2222 }, "socketio": { "serveClient": false, "path": "/ssh/socket.io", "origins": "localhost:2222" }, "user": { "name": null, "password": null, "overridebasic": false }, "ssh": { "host": null, "port": 22, "term": "vt100", "readyTimeout": 20000 }, "terminal": { "cursorBlink": true, "scrollback": 10000, "tabStopWidth": 8, "bellStyle": "sound", "fontSize": 14 } }
关键配置项说明:
点击状态栏的Start logging开始记录终端数据,记录开始后会显示Download log选项,可随时下载日志。点击Logging - STOP LOG停止记录,再次点击Start logging会覆盖当前日志(建议先下载)。
访问部署后的WebSSH2服务:
http://localhost:2222/ssh/host/192.168.1.1?port=2244&header=My%20Header&headerBackground=red
访问后会通过HTTP Basic Auth提示输入SSH用户名和密码,验证通过后即可在浏览器中使用SSH终端。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务