Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Docker 构建镜像后访问3000端口页面无法打开(本地和服务器均是)ERR_CONNECTION_RESET #4682

Closed
1 of 3 tasks
doolachen opened this issue May 14, 2024 · 33 comments
Labels
bug Something isn't working

Comments

@doolachen
Copy link

Bug Description

如题

Steps to Reproduce

  1. 拉取最新镜像 git clone https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web
  2. cd ChatGPT-Next-Web
  3. 构建docker镜像 docker build --platform=linux/amd64 -t myname .
  4. docker tag myname account/myname:latest
  5. docker push account/myname:latest
  6. 服务器拉取构建的镜像 docker pull account/myname:latest
  7. 运行容器 docker run -d -p 3000:3000 \ -e OPENAI_API_KEY=sk-xxxx \ -e CODE=your-password \ account/myname
  8. 访问ip:3000端口出现502 bad gateway

Expected Behavior

之前版本是可以正常构建并且push部署
同时我尝试了本地构建本地运行,出现ERR_CONNECTION_RESET

Screenshots

查看docker日志:
docker logs e2f4518c958c

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 127.0.0.1 7890
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local:        http://127.0.0.1:3000
   - Network:      http://127.0.0.1:3000

 ✓ Ready in 41ms

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

MacOS 13 /Ubuntu 20.04

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@doolachen doolachen added the bug Something isn't working label May 14, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] After Docker builds the image, the page accessing port 3000 cannot be opened (both locally and on the server) ERR_CONNECTION_RESET

Bug Description

As title

Steps to Reproduce

  1. Pull the latest image git clone https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web
  2. cd ChatGPT-Next-Web
  3. Build the docker image docker build --platform=linux/amd64 -t myname .
  4. docker tag myname account/myname:latest
  5. docker push account/myname:latest
  6. The server pulls the built image docker pull account/myname:latest
  7. Run the container docker run -d -p 3000:3000 \ -e OPENAI_API_KEY=sk-xxxx \ -e CODE=your-password \ account/myname
  8. When accessing port ip:3000, 502 bad gateway appears.

Expected Behavior

The previous version can be built normally and pushed for deployment
At the same time I tried building locally and running it locally, and ERR_CONNECTION_RESET appeared.

Screenshots

Check the docker log:
docker logs e2f4518c958c

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 127.0.0.1 7890
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local: http://127.0.0.1:3000
   - Network: http://127.0.0.1:3000

 ✓ Ready in 41ms

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

MacOS 13/Ubuntu 20.04

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@doolachen
Copy link
Author

尝试在容器内部手动执行node server.js后执行成功,dockerfile是否存在一些问题?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After trying to manually execute node server.js inside the container, the execution was successful. Are there any problems with the dockerfile?

@ReeseWang
Copy link
Contributor

在容器内运行netstat -l发现node监听的地址是localhost:3000,与两周前上一个版本的:::3000不同。Dockerfile上次修改是5个月前,不应该是Dockerfile的问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Run netstat -l in the container and find that the address monitored by the node is localhost:3000, which is different from :::3000 in the previous version two weeks ago. The Dockerfile was last modified 5 months ago. It should not be a problem with the Dockerfile.

@ReeseWang
Copy link
Contributor

二分法查了一下,可能是把Next.js从13.4.9升级到14.1.1导致的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After checking the dichotomy, it may be caused by upgrading Next.js from 13.4.9 to 14.1.1

@doolachen
Copy link
Author

二分法查了一下,可能是把Next.js从13.4.9升级到14.1.1导致的

尝试仅回滚next.js升级的部分,问题依旧存在

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After checking the dichotomy, it may be caused by upgrading Next.js from 13.4.9 to 14.1.1

Tried rolling back only the upgrade part of next.js, the problem still exists

@chizhiao
Copy link

same question

@coderc
Copy link

coderc commented May 14, 2024

Looking forward to the solution!!!

@hrz6976
Copy link

hrz6976 commented May 14, 2024

Looks like they are working on a fix: #4689, guess that's something caused by the update of next.js -> 14.

As a temporary walkaround, add the following one-liner to the docker run command:

docker run -d --network host yidadaa/chatgpt-next-web:v2.12.3 sh -c 'if [ -n "$PROXY_URL" ]; then export HOSTNAME="0.0.0.0"; protocol=$(echo $PROXY_URL | cut -d: -f1); host=$(echo $PROXY_U
RL | cut -d/ -f3 | cut -d: -f1); port=$(echo $PROXY_URL | cut -d: -f3); conf=/etc/proxychains.conf; echo "strict_chain" > $conf; echo "proxy_dn
s" >> $conf; echo "remote_dns_subnet 224" >> $conf; echo "tcp_read_time_out 15000" >> $conf; echo "tcp_connect_time_out 8000" >> $conf; echo "l
ocalnet 127.0.0.0/255.0.0.0" >> $conf; echo "localnet ::1/128" >> $conf; echo "[ProxyList]" >> $conf; echo "$protocol $host $port" >> $conf; ca
t /etc/proxychains.conf; proxychains -f $conf node server.js; else node server.js; fi'

Now the container binds 0.0.0.0:

[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local:        http://localhost:3000
   - Network:      http://0.0.0.0:3000

ReeseWang added a commit to ReeseWang/ChatGPT-Next-Web that referenced this issue May 15, 2024
@LoopOptimum
Copy link

我也遇到了相同问题,我想是代理的原因。
本人在境外,只要不定义 PROXY_URL 就正常
但是远程内地的主机定义本地代理后就出现这个问题,代理本身是没问题的,就算有问题应该也是API请求超时而不是无法访问

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I also encountered the same problem, I think it is the proxy.
I am overseas, so as long as PROXY_URL is not defined, it will be fine.
However, this problem occurs after the local proxy is defined on the remote mainland host. The proxy itself is fine. Even if there is a problem, it should be because the API request has timed out rather than being inaccessible.

@ReeseWang
Copy link
Contributor

@LoopOptimum 不是代理的问题。之前为了解决 #1556 ,这里加了个逻辑:如果有PROXY_URL,就设置HOSTNAME=127.0.0.1

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

但是HOSTNAME会被用来设置监听地址(可能是Next.js 14的新行为),而监听127.0.0.1会拒绝一切外部访问。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@LoopOptimum It's not the proxy's problem. In order to solve #1556, a logic was added here: if there is PROXY_URL, set HOSTNAME=127.0.0.1.

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

However, HOSTNAME will be used to set the listening address (maybe a new behavior of Next.js 14), and listening on 127.0.0.1 will deny all external access.

@LoopOptimum
Copy link

@LoopOptimum 不是代理的问题。之前为了解决 #1556 ,这里加了个逻辑:如果有PROXY_URL,就设置HOSTNAME=127.0.0.1

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

但是HOSTNAME会被用来设置监听地址(可能是Next.js 14的新行为),而监听127.0.0.1会拒绝一切外部访问。

我回滚到v2.12.2 没有出现这个问题, v2.12.3 尝试用ipv6 可以访问,但是API请求超时

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@LoopOptimum It's not the proxy's problem. In order to solve #1556, a logic was added here: if there is PROXY_URL, set HOSTNAME=127.0.0.1.

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

But HOSTNAME will be used to set the listening address (may be a new behavior of Next.js 14), and listening on 127.0.0.1 will deny all external access.

I rolled back to v2.12.2 and this problem did not occur. v2.12.3 can be accessed when trying to use ipv6, but the API request times out.

@doolachen
Copy link
Author

doolachen commented May 15, 2024

@LoopOptimum 不是代理的问题。之前为了解决 #1556 ,这里加了个逻辑:如果有PROXY_URL,就设置HOSTNAME=127.0.0.1

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

但是HOSTNAME会被用来设置监听地址(可能是Next.js 14的新行为),而监听127.0.0.1会拒绝一切外部访问。

请问你删除后有尝试过自己再次构建docker镜像吗?我按你的方案删除了export HOSTNAME="127.0.0.1"; \
docker history显示docker执行确实没有HOSTNAME了:

sha256:a34fa6ea6c94f19112c65cddb01415816a47b02e3e9c3d68d968fa8005a32f09   20 minutes ago   CMD ["/bin/sh" "-c" "if [ -n \"$PROXY_URL\" ]; then     protocol=$(echo $PROXY_URL | cut -d: -f1);     host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1);     port=$(echo $PROXY_URL | cut -d: -f3);     conf=/etc/proxychains.conf;     echo \"strict_chain\" > $conf;     echo \"proxy_dns\" >> $conf;     echo \"remote_dns_subnet 224\" >> $conf;     echo \"tcp_read_time_out 15000\" >> $conf;     echo \"tcp_connect_time_out 8000\" >> $conf;     echo \"localnet 127.0.0.0/255.0.0.0\" >> $conf;     echo \"localnet ::1/128\" >> $conf;     echo \"[ProxyList]\" >> $conf;     echo \"$protocol $host $port\" >> $conf;     cat /etc/proxychains.conf;     proxychains -f $conf node server.js;     else     node server.js;     fi"] 

docker logs结果next.js依然监听127.0.0.1

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 172.25.131.140 7899 doola dorachen
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local:        http://25eff16d89df:3000
   - Network:      http://127.0.0.1:3000

 ✓ Ready in 101ms

同时也尝试修改HOSTNAME="0.0.0.0" 问题依旧没有得到解决

也许是我绑定的本地port端口为3001(测试目的)所导致的,有任何想法或建议吗?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@LoopOptimum It's not the proxy's problem. In order to solve #1556, a logic was added here: if there is PROXY_URL, set HOSTNAME=127.0.0.1.

CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \

But HOSTNAME will be used to set the listening address (may be a new behavior of Next.js 14), and listening on 127.0.0.1 will deny all external access.

Have you tried building the docker image again after deleting it? I deleted export HOSTNAME="127.0.0.1"; \ according to your plan,
docker history shows that there is indeed no HOSTNAME in docker execution:

sha256:a34fa6ea6c94f19112c65cddb01415816a47b02e3e9c3d68d968fa8005a32f09 20 minutes ago CMD ["/bin/sh" "-c" "if [ -n \"$PROXY_URL\" ]; then protocol=$(echo $PROXY_URL | cut -d: - f1); host =$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); port=$(echo $PROXY_URL | cut -d: -f3); conf=/etc/proxychains.conf; echo \" strict_chain\" > $conf; echo \"proxy_dns\" >> $conf; echo \"remote_dns_subnet 224\" >> $conf; echo \"tcp_read_time_out 15000\" >> $conf; echo \"tcp_connect_time_out 8000\" > > $conf; echo \"localnet 127.0.0.0/255.0.0.0\" >> $conf; echo \"localnet ::1/128\" >> $conf; echo \"[ProxyList]\" >> $conf ; echo \"$protocol $host $port\" >> $conf; cat /etc/proxychains.conf; proxychains -f $conf node server.js; else node server.js; fi"]
docker logs results next.js is still listening to 127.0.0.1

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 172.25.131.140 7899 doola dorachen
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local: http://25eff16d89df:3000
   - Network: http://127.0.0.1:3000

 ✓ Ready in 101ms

At the same time, I also tried to modify HOSTNAME="0.0.0.0" but the problem was still not solved.

@ReeseWang
Copy link
Contributor

ReeseWang commented May 15, 2024

同时也尝试修改HOSTNAME="0.0.0.0" 问题依旧没有得到解决

这样设置以后的log是什么?删掉这行的确不能解决问题,见 #4689 (comment) 。我最终的解决方案是HOSTNAME=0.0.0.0

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Also tried modifying HOSTNAME="0.0.0.0" but the problem is still not solved.

What will be the log after setting like this?

@doolachen
Copy link
Author

doolachen commented May 15, 2024

同时也尝试修改HOSTNAME="0.0.0.0" 问题依旧没有得到解决

这样设置以后的log是什么?删掉这行的确不能解决问题,见 #4689 (comment) 。我最终的解决方案是HOSTNAME=0.0.0.0

我参考#4682 (comment)的方法重新执行docker run命令,绑定本机3000端口运行正常了。
我想之前是因为我的3000端口有一个进程在运行,因此我使用3001作为替代 并且删除了--network host字段,通过3001端口仍然无法访问,命令为:
docker run -d -p 3001:3000 -e PROXY_URL="" image/image-name:latest sh -c 'if [ -n "$PROXY_URL" ]; then export HOSTNAME="0.0.0.0"; protocol=$(echo $PROXY_URL | cut -d: -f1); host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); port=$(echo $PROXY_URL | cut -d: -f3); conf=/etc/proxychains.conf; echo "strict_chain" > $conf; echo "proxy_dns" >> $conf; echo "remote_dns_subnet 224" >> $conf; echo "tcp_read_time_out 15000" >> $conf; echo "tcp_connect_time_out 8000" >> $conf; echo "localnet 127.0.0.0/255.0.0.0" >> $conf; echo "localnet ::1/128" >> $conf; echo "[ProxyList]" >> $conf; echo "$protocol $host $port" >> $conf; cat /etc/proxychains.conf; proxychains -f $conf node server.js; else node server.js; fi'

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 172.25.131.140 7899 doola dorachen
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local:        http://localhost:3000
   - Network:      http://0.0.0.0:3000

 ✓ Ready in 87ms

修改了容器外监听端口为3001后就出现了问题,现在我已经重新使用3000端口,可以正常运行

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Also tried modifying HOSTNAME="0.0.0.0" but the problem is still not solved.

What will be the log after setting like this? Deleting this line does not solve the problem, see #4689 (comment). My final solution was HOSTNAME=0.0.0.0

I followed the method of #4682 (comment) and re-executed the docker run command. Binding the local port 3000 ran normally.
I think it was because I had a process running on port 3000, so I used 3001 as an alternative and removed the --network host field. It was still inaccessible through port 3001. The command was:
docker run -d -p 3001:3000 -e PROXY_URL="" image/image-name:latest sh -c 'if [ -n "$PROXY_URL" ]; then export HOSTNAME="0.0.0.0"; protocol=$ (echo $PROXY_URL | cut -d: -f1); host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); port=$(echo $PROXY_URL | cut -d: -f3 ); conf=/etc/proxychains.conf; echo "strict_chain" > $conf; echo "proxy_dns" >> $conf; echo "remote_dns_subnet 224" >> $conf; echo "tcp_read_time_out 15000" >> $conf; echo " tcp_connect_time_out 8000" >> $conf; echo "localnet 127.0.0.0/255.0.0.0" >> $conf; echo "localnet ::1/128" >> $conf; echo "[ProxyList]" >> $conf; echo "$protocol $host $port" >> $conf; cat /etc/proxychains.conf; proxychains -f $conf node server.js; else node server.js; fi'

strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 172.25.131.140 7899 doola dorachen
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.16
   ▲ Next.js 14.1.1
   - Local: http://localhost:3000
   - Network: http://0.0.0.0:3000

 ✓ Ready in 87ms

The problem occurred after I changed the listening port outside the container to 3001. Now I have reused port 3000 and it can run normally.

@Lujnjie
Copy link

Lujnjie commented May 15, 2024

在启动的时候覆盖Dockfile中 “export HOSTNAME=127.0.0.1” 为 “export HOSTNAME=0.0.0.0”,启动正常了!
sudo docker run -id -p 3001:3000 -e OPENAI_API_KEY=sk-xxx -e PROXY_URL=http://xxx -e CODE=xxx yidadaa/chatgpt-next-web sh -c 'export HOSTNAME=0.0.0.0; if [ -n "$PROXY_URL" ]; then \ protocol=$(echo $PROXY_URL | cut -d: -f1); \ host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ port=$(echo $PROXY_URL | cut -d: -f3); \ conf=/etc/proxychains.conf; \ echo "strict_chain" > $conf; \ echo "proxy_dns" >> $conf; \ echo "remote_dns_subnet 224" >> $conf; \ echo "tcp_read_time_out 15000" >> $conf; \ echo "tcp_connect_time_out 8000" >> $conf; \ echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \ echo "localnet ::1/128" >> $conf; \ echo "[ProxyList]" >> $conf; \ echo "$protocol $host $port" >> $conf; \ cat /etc/proxychains.conf; \ proxychains -f $conf node server.js; \ else \ node server.js; \ fi'

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


在启动的时候覆盖Dockfile中 “export HOSTNAME=127.0.0.1” 为 “export HOSTNAME=0.0.0.0”,启动正常了!
sudo docker run -id -p 3001:3000 -e OPENAI_API_KEY=sk-xxx -e PROXY_URL=http://xxx -e CODE=xxx yidadaa/chatgpt-next-web sh -c 'export HOSTNAME=0.0.0.0; if [ -n "$PROXY_URL" ]; then \ protocol=$(echo $PROXY_URL | cut -d: -f1); \ host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ port=$(echo $PROXY_URL | cut -d: -f3); \ conf=/etc/proxychains.conf; \ echo "strict_chain" > $conf; \ echo "proxy_dns" >> $conf; \ echo "remote_dns_subnet 224" >> $conf; \ echo "tcp_read_time_out 15000" >> $conf; \ echo "tcp_connect_time_out 8000" >> $conf; \ echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \ echo "localnet ::1/128" >> $conf; \ echo "[ProxyList]" >> $conf; \ echo "$protocol $host $port" >> $conf; \ cat /etc/proxychains.conf; \ proxychains -f $conf node server.js; \ else \ node server.js; \ fi'

@ahzmr
Copy link

ahzmr commented May 16, 2024

看到现在还没有提供解决办法,我先临时用不重新编译的方式解决,方法如下:

  1. 通过配置文件配置代理: proxychains.conf
  2. 改docker启动命令和挂载解决: docker-compose.yml

这种方式影响小,希望对大伙有用。

附件:

  1. proxychains.conf
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 192.168.31.1 1087
  1. docker-compose.yml
version: '3.3'

services:
    chatgpt-next-web:
        image: yidadaa/chatgpt-next-web
        restart: always
        container_name: chatgpt-next-web
        ...
        environment:
          ...
          HOSTNAME: '0.0.0.0'
        command: ["proxychains", "-f", "/etc/proxychains.conf", "node", "server.js"]
        volumes:
          - ./proxychains.conf:/etc/proxychains.conf

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Seeing that there is no solution provided yet, I will temporarily solve it without recompiling. The method is as follows:

  1. Configure the proxy through the configuration file: proxychains.conf;
  2. Change the docker startup command and mounting solution: docker-compose.yml.

This method has little impact and I hope it will be useful to everyone.

appendix:

  1. proxychains.conf
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 192.168.31.1 1087
  1. docker-compose.yml
version: '3.3'

services:
    chatgpt-next-web:
        image: yidadaa/chatgpt-next-web
        restart: always
        container_name: chatgpt-next-web
        ...
        environment:
          ...
          HOSTNAME: '0.0.0.0'
        command: ["proxychains", "-f", "/etc/proxychains.conf", "node", "server.js"]
        volumes:
          - ./proxychains.conf:/etc/proxychains.conf

@ItTonySuperMan
Copy link

尝试在容器内部手动执行node server.js后执行成功,dockerfile是否存在一些问题?

根据这个提示之后,我暂时用以下命令临时解决
docker exec 容器名 node server.js &

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After trying to manually execute node server.js inside the container, the execution was successful. Are there any problems with the dockerfile?

After following this tip, I temporarily solved it by using the following command
docker exec container name node server.js &

@miladhatami1393
Copy link

After checking the dichotomy, it may be caused by upgrading Next.js from 13.4.9 to 14.1.1

@LoopOptimum
Copy link

看到现在还没有提供解决办法,我先临时用不重新编译的方式解决,方法如下:

  1. 通过配置文件配置代理: proxychains.conf
  2. 改docker启动命令和挂载解决: docker-compose.yml

这种方式影响小,希望对大伙有用。

附件:

  1. proxychains.conf
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 192.168.31.1 1087
  1. docker-compose.yml
version: '3.3'

services:
    chatgpt-next-web:
        image: yidadaa/chatgpt-next-web
        restart: always
        container_name: chatgpt-next-web
        ...
        environment:
          ...
          HOSTNAME: '0.0.0.0'
        command: ["proxychains", "-f", "/etc/proxychains.conf", "node", "server.js"]
        volumes:
          - ./proxychains.conf:/etc/proxychains.conf

已经解决,不过代理不能用127.0.0.1:端口,只能用主机自己的局域网IP

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Seeing that there is no solution provided yet, I will temporarily solve it without recompiling. The method is as follows:

  1. Configure the proxy through the configuration file: proxychains.conf;
  2. Change the docker startup command and mounting solution: docker-compose.yml.

This method has little impact and I hope it will be useful to everyone.

Accessories:

  1. proxychains.conf
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet ::1/128
[ProxyList]
http 192.168.31.1 1087
  1. docker-compose.yml
version: '3.3'

services:
chatgpt-next-web:
image: yidadaa/chatgpt-next-web
restart: always
container_name: chatgpt-next-web
...
environment:
...
HOSTNAME: '0.0.0.0'
command: ["proxychains", "-f", "/etc/proxychains.conf", "node", "server.js"]
volumes:
- ./proxychains.conf:/etc/proxychains.conf

It has been solved, but the proxy cannot use the 127.0.0.1: port, and can only use the host's own LAN IP.

fred-bf added a commit that referenced this issue May 22, 2024
Dockerfile: Listen to any addresses instead of localhost, fixes #4682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests