Skip to content

Commit 96d9504

Browse files
docs: explain HTTP proxy address when AstrBot runs in Docker (#10162)
* docs: explain HTTP proxy address when AstrBot runs in Docker * Apply suggestion from @sourcery-ai[bot] Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 6914bc3 commit 96d9504

6 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎docs/en/deploy/astrbot/docker.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,16 @@ If there are no errors, you will see a log message similar to `🌈 Dashboard st
124124
> If deployed on a cloud server, you need to open ports `6180-6200` and `11451` in the cloud provider's console.
125125
126126
Next, you need to deploy any messaging platform to use AstrBot on that platform.
127+
128+
## Configure an HTTP proxy in Docker
129+
130+
Set the HTTP proxy in the WebUI under `Settings → Network → Proxy & Dependency Sources → HTTP Proxy`. AstrBot reaches that address **from inside its own container**, so `http://127.0.0.1:7890` points at the AstrBot container itself rather than the host or another container.
131+
132+
If the proxy runs on the host, or in another container with the port published to the host:
133+
134+
- Mac / Windows (Docker Desktop): `http://host.docker.internal:7890`
135+
- Linux: `http://172.17.0.1:7890` (replace `172.17.0.1` with your docker0 gateway if it differs)
136+
137+
If AstrBot and the proxy share a Docker network, use the proxy container name, for example `http://clash:7890`.
138+
139+
Clash-style clients commonly use HTTP on `7890` and SOCKS on `7891`. Use `http://` or `socks5://` to match the protocol. For a host-installed proxy, it must listen on a host interface reachable from Docker, such as `0.0.0.0` or the Docker gateway interface, rather than only `127.0.0.1`; publish the proxy port to the host.

‎docs/en/dev/astrbot-config.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ Whether to enable the file service. Default is `false`. When enabled, the bot pr
489489

490490
### `http_proxy`
491491

492-
HTTP proxy. E.g., `http://localhost:7890`.
492+
HTTP proxy. E.g., `http://localhost:7890`. When AstrBot runs in Docker, use an address reachable from the AstrBot container. See [Deploy with Docker](/en/deploy/astrbot/docker.md).
493493

494494
### `no_proxy`
495495

‎docs/en/use/webui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Global settings are under `Settings` at the bottom of the sidebar:
9292

9393
- `General`: timezone, external callback address, logs, and cache.
9494
- `Appearance`: sidebar, theme, and text-to-image rendering.
95-
- `Network`: HTTP proxy, Python package sources, and GitHub proxy.
95+
- `Network`: HTTP proxy, Python package sources, and GitHub proxy. For the address to use when AstrBot runs in Docker, see [Deploy with Docker](/en/deploy/astrbot/docker.md).
9696
- `Security`: WebUI HTTPS, login rate limits, and TOTP.
9797
- `Maintenance`: backup, restore, and restart.
9898
- `OpenAPI`: developer access keys.

‎docs/zh/deploy/astrbot/docker.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,16 @@ docker run -itd -p 6185:6185 -p 6199:6199 -e TZ=Asia/Shanghai -v "${PWD}\data:/A
140140
> 如果部署在云服务器上,需要在相应厂商控制台里放行对应端口。
141141
142142
接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。
143+
144+
## 在 Docker 中配置 HTTP 代理
145+
146+
AstrBot 的 HTTP 代理在 WebUI:`设置 → 网络 → 代理与依赖源 → HTTP 代理`。填写的地址由 **AstrBot 容器内部**访问,因此 `http://127.0.0.1:7890` 会连到 AstrBot 容器自己,而不是宿主机或其他容器。
147+
148+
代理跑在宿主机、或另一个容器并把端口映射到宿主机时:
149+
150+
- Mac / Windows(Docker Desktop):`http://host.docker.internal:7890`
151+
- Linux:`http://172.17.0.1:7890`(把 `172.17.0.1` 换成本机 docker0 网关)
152+
153+
AstrBot 与代理在同一 Docker 网络时,用容器名,例如 `http://clash:7890`。
154+
155+
Clash 一类软件常见 HTTP `7890`、SOCKS `7891`,按实际协议写 `http://` 或 `socks5://`。请确认代理端口已映射到宿主机,且不是只绑在 `127.0.0.1`(写成 `127.0.0.1:7890:7890` 时,其他容器从网关进不去)。

‎docs/zh/dev/astrbot-config.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ AstrBot API 的地址。用于渲染 Markdown 图片。当 `t2i_strategy` 为 `r
489489

490490
### `http_proxy`
491491

492-
HTTP 代理。如 `http://localhost:7890`。
492+
HTTP 代理。如 `http://localhost:7890`。Docker 部署时请填写 AstrBot 容器能访问到的地址,见 [Docker 部署](/deploy/astrbot/docker.md)。
493493

494494
### `no_proxy`
495495

‎docs/zh/use/webui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ ChatUI 支持以下常用能力:
9292

9393
- `常规`:时区、外部回调地址、日志和缓存。
9494
- `外观`:侧边栏、主题和文本转图像。
95-
- `网络`:HTTP 代理、Python 依赖源和 GitHub 加速地址。
95+
- `网络`:HTTP 代理、Python 依赖源和 GitHub 加速地址。Docker 下的代理填法见 [Docker 部署](/deploy/astrbot/docker.md)。
9696
- `安全`:WebUI HTTPS、登录限速和 TOTP。
9797
- `维护`:备份、恢复和重启。
9898
- `OpenAPI`:开发者访问密钥。

0 commit comments

Comments
 (0)