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镜像到2.12.3之后,无法使用PROXY_URL字段 #4747

Closed
1 of 3 tasks
yangxiang92 opened this issue May 21, 2024 · 9 comments
Closed
1 of 3 tasks
Labels
bug Something isn't working

Comments

@yangxiang92
Copy link

yangxiang92 commented May 21, 2024

Bug Description

更新Docker镜像到2.12.3之后,使用PROXY_URL字段,容器无法正常运行。去掉PROXY_URL字段后,容器可以正常运行。

Steps to Reproduce

运行脚本

docker run -d -p 3002:3000 \
    -e OPENAI_API_KEY=${API_KEY} \
    -e CODE="aaaaaa" \
    -e PROXY_URL="socks5://192.168.0.245:7890" \
    -e CUSTOM_MODELS="-all,+gpt-3.5-turbo,+gpt-4-turbo,+gpt-4o" \
    -e HIDE_USER_API_KEY=1 \
    --name chatgpt_next_web_test \
    --restart always \
    yidadaa/chatgpt-next-web

访问http://localhost:3002 ,得到结果如下:

image

修改脚本为:

docker run -d -p 3002:3000 \
    -e OPENAI_API_KEY=${API_KEY} \
    -e CODE="aaaaaa" \
    -e CUSTOM_MODELS="-all,+gpt-3.5-turbo,+gpt-4-turbo,+gpt-4o" \
    -e HIDE_USER_API_KEY=1 \
    --name chatgpt_next_web_test \
    --restart always \
    yidadaa/chatgpt-next-web

访问http://localhost:3002 ,得到结果如下:

image

Expected Behavior

定义了PROXY_URL后,容器仍可以正常使用。

Screenshots

No response

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

Ubuntu

Desktop Browser

Chrome

Desktop Browser Version

Version 122.0.6261.111 (Official Build) (64-bit)

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

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

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


Title: [Bug] After updating the Docker image to 2.12.3, the PROXY_URL field cannot be used

@liu0050
Copy link

liu0050 commented May 21, 2024

我也遇到了同样的问题,升级到2.12.3版本后容器无法再使用主机的代理。
image

@Issues-translate-bot
Copy link

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


I also encountered the same problem. After upgrading to version 2.12.3, the container can no longer use the host's agent.
image

@fred-bf
Copy link
Contributor

fred-bf commented May 22, 2024

@liu0050 @yangxiang92 would you mind try rebuild the latest commit's docker image to see whether the issue have been resolved?

@yangxiang92
Copy link
Author

@liu0050 @yangxiang92 would you mind try rebuild the latest commit's docker image to see whether the issue have been resolved?

I have rebuild docker image with the latest commit of "main" branch (commit id: 3866448).
The issue is not resolved yet.

@nutinshell
Copy link

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

@yangxiang92
Copy link
Author

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

@nutinshell
Copy link

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

Yes, that's the right fix for proxy...

@yangxiang92
Copy link
Author

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

Yes, that's the right fix for proxy...

Sorry, I misunderstood your meaning. Removing the quotes solves this issue! Thank you!

For reference, here is the modified content:

CMD if [ -n "$PROXY_URL" ]; then \
    export HOSTNAME="127.0.0.1"; \
    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 --host 0.0.0.0; \
    else \
    node server.js; \
    fi

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

6 participants