VergilGao / docker-mdc

https://github.com/yoshiko2/Movie_Data_Capture 的 docker镜像,帮助你更优雅的管理硬盘中的大姐姐们。
GNU General Public License v3.0
558 stars 94 forks source link

代理设置问题 #51

Closed henry-tujia closed 2 years ago

henry-tujia commented 2 years ago

背景

本地服务器已部署clash,已经测试可以使用http_proxyhttps_proxy进行google的下载

root@openmediavault:~# wget www.google.com
--2022-03-24 22:15:44--  http://www.google.com/
正在连接 127.0.0.1:7890... 已连接。
已发出 Proxy 请求,正在等待回应... 302 Found
位置:http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1648131374613142&usg=AOvVaw2kJUmLBg5Uf9W9wxigWGzf [跟随至新的 URL]
--2022-03-24 22:15:44--  http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1648131374613142&usg=AOvVaw2kJUmLBg5Uf9W9wxigWGzf
再次使用存在的到 127.0.0.1:7890 的连接。
已发出 Proxy 请求,正在等待回应... 302 Found
位置:http://www.google.com.hk/ [跟随至新的 URL]
--2022-03-24 22:15:44--  http://www.google.com.hk/
再次使用存在的到 127.0.0.1:7890 的连接。
已发出 Proxy 请求,正在等待回应... 200 OK
长度:未指定 [text/html]
正在保存至: “index.html.2”

index.html.2                                          [ <=>                                                                                                        ]  13.61K  --.-KB/s  用时 0.001s

2022-03-24 22:15:45 (25.3 MB/s) - “index.html.2” 已保存 [13932]

docker错误日志

使用命令为:docker run --rm -it --name mdc_test -v ${PWD}/test:/data -e PUID=1000 -e PGID=1000 -e USE_PROXY=1 -e PROXY_TYPE="http" -e PROXY_URI="127.0.0.1:7890" vergilgao/mdc:latest

日志如下:

root@openmediavault:/srv/dev-disk-by-uuid-2ee14b13-898d-4375-9a5f-6309fcd3ca27/resources# docker run --rm -it   --name mdc_test   -v ${PWD}/test:/data   -e PUID=1000  -e PGID=1000  -e USE_PROXY=1   -e PROXY_TYPE="http"   -e PROXY_URI="127.0.0.1:7890"   vergilgao/mdc:latest
Setup Timezone to Asia/Shanghai
Checking if UID: 1000 matches user
usermod: no changes
Checking if GID: 1000 matches user
usermod: no changes
Setting umask to 000
Checking if config file exist
Starting...
[*]================= Movie Data Capture =================
[*]                        6.0.2
[*]======================================================
[*] - Linux-5.10.0-0.bpo.8-amd64-x86_64-with
[*] - x86_64 - Python-3.8.12
[*]======================================================
[*] - 严禁在墙内宣传本项目 -
[*]======================================================
[+]Start at 2022-03-24 22:13:18
[+]Load Config file '/config/mdc.ini'.
[+]Main Working mode ## 1: Scraping ## , multi_threading on, nfo_skip_days=30
[-]Connect retry 1/3
[-]Connect retry 1/3
[-]Connect retry 2/3
[-]Connect retry 1/3
[-]Connect retry 2/3
[-]Connect retry 3/3
[-]HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /yoshiko2/Movie_Data_Capture/master/MappingTable/mapping_info.xml (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7b44664370>: Failed to establish a new connection: [Errno 111] Connection refused')))
[-]Connect Failed! Please check your Proxy or Network!
[-]Connect retry 3/3
[-]HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /yoshiko2/Movie_Data_Capture/master/MappingTable/c_number.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7b446e6b20>: Failed to establish a new connection: [Errno 111] Connection refused')))
[-]Connect Failed! Please check your Proxy or Network!
[-]Connect retry 2/3
[-]Connect retry 3/3
[-]HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /yoshiko2/Movie_Data_Capture/master/MappingTable/mapping_actor.xml (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7b4468e5b0>: Failed to establish a new connection: [Errno 111] Connection refused')))
[-]Connect Failed! Please check your Proxy or Network!
Traceback (most recent call last):
  File "Movie_Data_Capture.py", line 618, in <module>
  File "Movie_Data_Capture.py", line 542, in main
  File "ADC_function.py", line 556, in parallel_download_files
  File "concurrent/futures/_base.py", line 619, in result_iterator
  File "concurrent/futures/_base.py", line 444, in result
  File "concurrent/futures/_base.py", line 389, in __get_result
  File "concurrent/futures/thread.py", line 57, in run
  File "ADC_function.py", line 528, in download_one_file
  File "ADC_function.py", line 523, in _inner
  File "ADC_function.py", line 70, in get_html
Exception: Connect Failed
[16] Failed to execute script 'Movie_Data_Capture' due to unhandled exception!

怀疑是proxy没有正确在urllib3中配置

VergilGao commented 2 years ago

docker运行参数加上 -network=host

henry-tujia commented 2 years ago

docker 运行参数加上 -network=host

感想大佬回复,加上命令第一次成功,日志如下:

root@openmediavault:/srv/dev-disk-by-uuid-2ee14b13-898d-4375-9a5f-6309fcd3ca27/resources# docker run --rm -it --name mdc_test --network=host -v ${PWD}/test:/data -e PUID=1000 -e PGID=1000 -e USE_PRO
XY=1 -e PROXY_TYPE="http" -e PROXY_URI="127.0.0.1:7890" vergilgao/mdc:latest
Setup Timezone to Asia/Shanghai
Checking if UID: 1000 matches user
usermod: no changes
Checking if GID: 1000 matches user
usermod: no changes
Setting umask to 000
Checking if config file exist
Starting...
[*]================= Movie Data Capture =================
[*]                        6.0.2
[*]======================================================
[*] - Linux-5.10.0-0.bpo.8-amd64-x86_64-with
[*] - x86_64 - Python-3.8.12
[*]======================================================
[*] - 严禁在墙内宣传本项目 -
[*]======================================================
[+]Start at 2022-03-25 14:09:44
[+]Load Config file '/config/mdc.ini'.
[+]Main Working mode ## 1: Scraping ## , multi_threading on, nfo_skip_days=30
[+] [1/3] Mapping Table Downloaded to /config/.local/share/mdc/mapping_actor.xml
[+] [2/3] Mapping Table Downloaded to /config/.local/share/mdc/mapping_info.xml
[+] [3/3] Mapping Table Downloaded to /config/.local/share/mdc/c_number.json
[+]Find 1 movies.
[*]======================================================
[!]                - 100.% [1/1] -             14:09:47
[!] [MIFD-046] As Number making data for '/data/MIFD-046.mp4'
[-]Connect retry 1/3
[+]Find movie [MIFD-046] metadata on website 'javbus'
[+]Image Downloaded! output/御坂りあ/MIFD-046/MIFD-046-fanart.jpg
[+]Use model         hog
[-]Model found face  output/御坂りあ/MIFD-046/MIFD-046-fanart.jpg
[+]Image Cutted!     output/御坂りあ/MIFD-046/MIFD-046-poster.jpg
[+]Wrote!            output/御坂りあ/MIFD-046/MIFD-046.nfo
[*]======================================================
[+]Running time 0:00:11.578  End at 2022-03-25 14:09:56
[+]All finished!!!
Log file '/config/.mlogs/mdc_20220325T140944.txt' saved.

但是运行自己文件夹,使用命令docker run --rm -it --name mdc_test --network=host -v ${PWD}/./:/data -e PUID=1000 -e PGID=1000 -e USE_PROXY=1 -e PROXY_TYPE="http" -e PROXY_URI="127.0.0.1:7890" vergilgao/mdc:latest,出现错误,log为;

root@openmediavault:/srv/dev-disk-by-uuid-2ee14b13-898d-4375-9a5f-6309fcd3ca27/resources/sync/default_fake# docker run --rm -it --name mdc_test --network=host -v ${PWD}/./:/data -e PUID=1000 -e PGID=1000 -e USE_PROXY=1 -e PROXY_TYPE="http" -e PROXY_URI="127.0.0.1:7890"  vergilgao/mdc:latest
Setup Timezone to Asia/Shanghai
Checking if UID: 1000 matches user
usermod: no changes
Checking if GID: 1000 matches user
usermod: no changes
Setting umask to 000
Checking if config file exist
Starting...
[*]================= Movie Data Capture =================
[*]                        6.0.2
[*]======================================================
[*] - Linux-5.10.0-0.bpo.8-amd64-x86_64-with
[*] - x86_64 - Python-3.8.12
[*]======================================================
[*] - 严禁在墙内宣传本项目 -
[*]======================================================
[+]Start at 2022-03-25 14:25:24
[+]Load Config file '/data/config.ini'.
[+]Main Working mode ## 1: Scraping ## , nfo_skip_days=30
[-]Connect retry 1/3
[-]Connect retry 2/3
[-]Connect retry 3/3
[-]HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/yoshiko2/Movie_Data_Capture/releases/latest (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fddf493ccd0>: Failed to establish a new connection: [Errno 111] Connection refused')))
[-]Connect Failed! Please check your Proxy or Network!
===== Failed to connect to github =====
========== AUTO EXIT IN 60s ===========
henry-tujia commented 2 years ago

已测试通过