> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmollama/common-issues.md).

# Duaer 里 Ollama Model 的常见问题

Duaer 里 Ollama Model 的常见问题：连不上远程或 Docker 里的 Ollama、IPv6 报错、代理和表达式取值。
## 表达式只取第一条数据 <a href="#processing-parameters" id="processing-parameters"></a>

Ollama Model 是子节点。普通节点对每条输入分别计算表达式；Duaer 调用子节点时只用第一条输入。输入五个名字时，{{ $json.name }} 始终是第一个名字。

要让每条数据用不同的值，把表达式写在根节点里（例如 AI Agent 的 Prompt），或在前面用 Loop Over Items 一次处理一条。

## 连不上远程 Ollama <a href="#cant-connect-to-a-remote-ollama-instance" id="cant-connect-to-a-remote-ollama-instance"></a>

Ollama Model 按 Ollama 凭证里的 Base URL 连接（默认 http://localhost:11434）。远程 Ollama 放在需要鉴权的代理后面（例如 Open WebUI）时，Base URL 填远程地址，API Key 填代理给的密钥，Duaer 会以 Bearer 令牌发送。

## Docker 里连不上本机 Ollama <a href="#cant-connect-to-a-local-ollama-instance-when-using-docker" id="cant-connect-to-a-local-ollama-instance-when-using-docker"></a>

Docker 里每个容器都有自己的 localhost。Duaer 或 Ollama 只要有一个在容器里，就不能用 localhost 互相访问。按部署方式改 Ollama 凭证的 Base URL：

- 只有 Ollama 在容器里：启动时用 -p 11434:11434 映射端口，Base URL 用 http://localhost:11434。
- 只有 Duaer 在容器里：让本机 Ollama 监听 0.0.0.0，Base URL 用 http://host.docker.internal:11434。Linux 上启动 Duaer 容器时加 --add-host host.docker.internal:host-gateway；Docker Desktop 已自带。
- 两者在不同容器里：放进同一个 Docker 网络，Base URL 用 Ollama 的容器名，例如 http://my-ollama:11434。
- 两者在同一个容器里：直接用 http://localhost:11434。

## Error: connect ECONNREFUSED ::1:11434 <a href="#error-connect-econnrefused-111434" id="error-connect-econnrefused-111434"></a>

localhost 被解析成了 IPv6 地址，Ollama 却只监听 IPv4。把 Base URL 改成 http://127.0.0.1:11434。

## Ollama 与 HTTP/HTTPS 代理 <a href="#ollama-and-httphttps-proxies" id="ollama-and-httphttps-proxies"></a>

Ollama Model 不支持自定义 HTTP 代理，设了 HTTP_PROXY 或 HTTPS_PROXY 也可能不生效。需要代理时，参考 [Ollama 的代理说明](https://docs.ollama.com/faq#how-do-i-use-ollama-behind-a-proxy)，或让 Duaer 直连 Ollama。
## Questions

### Duaer 在 Docker 里怎么连本机的 Ollama？

把 Duaer 里 Ollama 凭证的 Base URL 设为 http://host.docker.internal:11434，并让本机 Ollama 监听 0.0.0.0。

