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

在docker镜像中添加socksio以支持代理 #309

Open
WallBreakerNO4 opened this issue Dec 21, 2024 · 1 comment
Open

在docker镜像中添加socksio以支持代理 #309

WallBreakerNO4 opened this issue Dec 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@WallBreakerNO4
Copy link

功能描述

希望能在docker镜像中添加socksio以支持环境变量配置代理
docker-compose.yml

services:
  pdf2zh:
    ports:
      - 27860:7860
    image: byaidu/pdf2zh
    restart: unless-stopped
    extra_hosts:
      - host.docker.internal:host-gateway
    environment:
      - https_proxy=http://host.docker.internal:7890
      - http_proxy=http://host.docker.internal:7890
      - all_proxy=socks5://host.docker.internal:7890

日志:

pdf2zh-1  | Traceback (most recent call last):
pdf2zh-1  |   File "/usr/local/bin/pdf2zh", line 5, in <module>
pdf2zh-1  |     from pdf2zh.pdf2zh import main
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/pdf2zh/__init__.py", line 2, in <module>
pdf2zh-1  |     from pdf2zh.high_level import translate, translate_stream
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/pdf2zh/high_level.py", line 13, in <module>
pdf2zh-1  |     from pdf2zh.converter import TranslateConverter
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/pdf2zh/converter.py", line 19, in <module>
pdf2zh-1  |     from pdf2zh.translator import (
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/pdf2zh/translator.py", line 8, in <module>
pdf2zh-1  |     import ollama
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/ollama/__init__.py", line 38, in <module>
pdf2zh-1  |     _client = Client()
pdf2zh-1  |               ^^^^^^^^
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/ollama/_client.py", line 115, in __init__
pdf2zh-1  |     super().__init__(httpx.Client, host, **kwargs)
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/ollama/_client.py", line 95, in __init__
pdf2zh-1  |     self._client = client(
pdf2zh-1  |                    ^^^^^^^
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 708, in __init__
pdf2zh-1  |     else self._init_proxy_transport(
pdf2zh-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 762, in _init_proxy_transport
pdf2zh-1  |     return HTTPTransport(
pdf2zh-1  |            ^^^^^^^^^^^^^^
pdf2zh-1  |   File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 178, in __init__
pdf2zh-1  |     raise ImportError(
pdf2zh-1  | ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
pdf2zh-1 exited with code 0
@awwaawwa
Copy link
Contributor

- all_proxy=socks5://host.docker.internal:7890的socks5改成http试试

@Byaidu Byaidu added the enhancement New feature or request label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants