lobehub/lobe-chat

[Bug] 本地127.0.0.1(localhost)地址无法使用,但是换成内网的IP地址可以正常访问 #1646

ryanzhaorx posted onGitHub

💻 Operating System

macOS

📦 Environment

Docker

🌐 Browser

Chrome

🐛 Bug Description

本地127.0.0.1(localhost)地址无法使用,但是换成内网的IP地址可以正常访问 { "error": { "cause": { "errno": -111, "code": "ECONNREFUSED", "syscall": "connect", "address": "127.0.0.1", "port": 3000 } }, "endpoint": "http://127.0.***.1:****/v1", "provider": "openai" }

🚦 Expected Behavior

能够正常使用localhost(127.0.0.1)

📷 Recurrence Steps

<img width="1053" alt="image" src="https://github.com/lobehub/lobe-chat/assets/103013573/f1d85a93-f3f6-4173-9816-d0886b7ed33f">

📝 Additional Information

NONE


👀 @ryanzhaorx

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

posted by lobehubbot 12 months ago
posted by ryanzhaorx 12 months ago

你是在 Docker 里面装的 lobehub 所以,你这里写 127.** 他访问的是他自己(lobehub容器本身),不是宿主机。 这不算是bug,也修不了。

posted by mingyue0094 12 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You installed lobehub in Docker, so when you write 127.** here, he is accessing himself (the lobehub container itself), not the host. This is not a bug and cannot be fixed.

posted by lobehubbot 12 months ago

你是在 Docker 里面装的 lobehub 所以,你这里写 127.** 他访问的是他自己(lobehub容器本身),不是宿主机。 这不算是bug,也修不了。

那我想访问宿主机的4000端口怎么设置?

posted by ryanzhaorx 12 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You installed lobehub in Docker, so when you write 127.** here, he is accessing himself (the lobehub container itself), not the host. This is not a bug and cannot be fixed.

So how do I set up port 4000 that I want to access the host?

posted by lobehubbot 12 months ago

Docker之间互通是需要映射容器端口到宿主机端口的,这样Docker访问其他的容器是使用宿主机的内网 IP:port 不同宿主机之间也可以用宿主机的映射出端口通信,如果外网访问则需要宿主机外网端口再映射到公网IP端口 Emm……可以去学习下Docker原理

posted by MapleEve 12 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


To communicate between Dockers, you need to map the container port to the host port. In this way, Docker uses the host's intranet IP:port to access other containers. Different hosts can also use the host's mapped port to communicate. If accessed from the external network, the host's external network port needs to be mapped to the public IP port. Emm...you can learn the principles of Docker

posted by lobehubbot 12 months ago

Fund this Issue

$0.00
Funded

Pull requests