{ "registry-mirrors": [ "https://docker.1ms.run" ] }
/etc/docker/daemon.json
收获爱
{ "registry-mirrors": [ "https://docker.1ms.run" ] }
/etc/docker/daemon.json
地址:https://huggingface.co/spaces/aadnk/faster-whisper-webui
對比了幾個更新一點的方案,有的增加了隊列和資源可視化,但是效率比較低,尤其是沒有優化顯存佔用,比如https://github.com/jhj0517/Whisper-WebUI,使用v3模型時需要25G顯存,我的3090還跑不起來了,而且並不支持詞級標註。
爲了更方便的使用aadnk/faster-whisper-webui,可以在其文件目錄中增加一個docker-compose.yml
services:
faster-whisper:
image: registry.gitlab.com/aadnk/whisper-webui:latest
container_name: faster-whisper
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
ports:
- "7001:7860"
volumes:
- ./cache/whisper:/root/.cache/whisper
- ./cache/huggingface:/root/.cache/huggingface
restart: on-failure:15
environment:
- HTTP_PROXY=http://192.168.1.200:16236
- HTTPS_PROXY=http://192.168.1.200:16236
- NO_PROXY=localhost,127.0.0.1,::1
command: >
app.py
--whisper_implementation whisper
--input_audio_max_duration -1
--server_name 0.0.0.0
--auto_parallel True
--default_vad silero-vad
--default_model_name large-v2
注意其中的large-v2也可以改爲large-v3,最新版已經支持。另外,HTTP_PROXY相關設置是爲了啓動時通過代理訪問gradio,否則會啓動失敗,通過environment來設置代理的方式比較靈活,不會影響其他docker容器,詳細情況參加我前面一篇博客。
在 Ubuntu 系統中設置代理:網絡連接、Shell 和 Docker 的配置方法與影響範圍在 Ubuntu 系統中,設置代理是常見的需求,特別是在企業網絡環境或需要訪問特定資源時。本文將詳細介紹如何在 Ubuntu 的網絡連接、Shell 環境以及 Docker 中設置代理,並闡述它們的影響範圍和注意事項。無論你是普通用戶還是開發者,這篇博客都能幫助你清晰理解代理配置的邏輯與實操。
1. 為什麼需要分別配置代理?在 Ubuntu 中,代理設置的應用範圍因環境而異:
由於這些環境的網絡棧相互獨立,代理設置不會自動共享,因此需要在每個環境中單獨配置。
2. 配置系統網絡代理方法Ubuntu 的圖形界面(如 GNOME)允許通過設置應用程序配置全局代理,影響支持系統代理的應用(如 Firefox、Chrome)。
sudo nano /etc/environment
添加:http_proxy="http://proxy_server:port" https_proxy="http://proxy_server:port" ftp_proxy="http://proxy_server:port" no_proxy="localhost,127.0.0.1,::1"
nmcli connection modify <connection_name> proxy.method manual nmcli connection modify <connection_name> proxy.http http://proxy_server:port nmcli connection modify <connection_name> proxy.https http://proxy_server:port
查看當前連接名稱:bashnmcli connection show
影響範圍
注意事項
3. 配置 Shell 環境代理Shell 環境中的命令行工具(如 curl、wget、apt)依賴環境變量或專屬配置文件來使用代理。方法3.1 臨時設置(僅當前會話)在 Shell 中設置環境變量:
bash
export http_proxy="http://proxy_server:port"
export https_proxy="http://proxy_server:port"
export ftp_proxy="http://proxy_server:port"
export no_proxy="localhost,127.0.0.1,::1"
這些設置僅對當前 Shell 會話有效,關閉終端後失效。3.2 全局設置將環境變量添加到 Shell 配置文件(如 ~/.bashrc 或 ~/.zshrc):
bash
echo 'export http_proxy="http://proxy_server:port"' >> ~/.bashrc
echo 'export https_proxy="http://proxy_server:port"' >> ~/.bashrc
echo 'export ftp_proxy="http://proxy_server:port"' >> ~/.bashrc
echo 'export no_proxy="localhost,127.0.0.1,::1"' >> ~/.bashrc
使配置生效:
bash
source ~/.bashrc
或者,編輯 /etc/environment(影響所有用戶):
bash
sudo nano /etc/environment
添加:
http_proxy="http://proxy_server:port"
https_proxy="http://proxy_server:port"
ftp_proxy="http://proxy_server:port"
no_proxy="localhost,127.0.0.1,::1"
3.3 特定工具配置某些工具需要獨立配置代理:
sudo nano /etc/apt/apt.conf.d/proxy.conf
添加:Acquire::http::Proxy "http://proxy_server:port"; Acquire::https::Proxy "http://proxy_server:port";
curl --proxy http://proxy_server:port http://example.com
或在 ~/.curlrc 中設置:bashecho "proxy = http://proxy_server:port" >> ~/.curlrc
echo "http_proxy = http://proxy_server:port" >> ~/.wgetrc echo "https_proxy = http://proxy_server:port" >> ~/.wgetrc echo "use_proxy = on" >> ~/.wgetrc
3.4 使用 proxychains(可選)對於不支持環境變量的工具,可以使用 proxychains:
sudo apt install proxychains
http proxy_server port
proxychains curl http://example.com
影響範圍
注意事項
unset http_proxy https_proxy
4. 配置 Docker 代理Docker 的代理設置分為兩部分:Docker 引擎(影響鏡像拉取)和容器內部(影響 Dockerfile 的 RUN 命令)。方法4.1 配置 Docker 引擎代理(用於拉取鏡像)Docker 引擎負責從倉庫(如 Docker Hub)下載鏡像,其代理設置獨立於 Shell 和系統代理。
{ "proxies": { "http-proxy": "http://proxy_server:port", "https-proxy": "http://proxy_server:port", "no-proxy": "localhost,127.0.0.1,::1" } }
sudo systemctl restart docker
docker info --format '{{.HTTPProxy}}'
4.2 配置容器內代理(用於 Dockerfile 的 RUN 命令)Dockerfile 中的 RUN 命令運行在臨時容器中,默認不繼承宿主機的代理設置。
FROM ubuntu:20.04 ENV http_proxy=http://proxy_server:port ENV https_proxy=http://proxy_server:port RUN apt-get update && apt-get install -y curl # 清理代理設置(安全考慮) ENV http_proxy="" ENV https_proxy=""
docker build \ --build-arg http_proxy=$http_proxy \ --build-arg https_proxy=$https_proxy \ --build-arg no_proxy=$no_proxy \ -t myimage .
RUN echo 'Acquire::http::Proxy "http://proxy_server:port";' > /etc/apt/apt.conf.d/proxy.conf RUN echo 'Acquire::https::Proxy "http://proxy_server:port";' >> /etc/apt/apt.conf.d/proxy.conf RUN apt-get update
影響範圍
注意事項
5. 驗證代理配置
env | grep -i proxy curl -I http://example.com
docker pull hello-world
RUN curl -I http://example.com
6. 總結與最佳實踐配置總結
最佳實踐
通過以上方法,你可以在 Ubuntu 中靈活配置代理,滿足不同場景的網絡需求。希望這篇博客能為你的代理設置提供清晰的指導!
from:grok
ps:要想從grok裏面整體複製以上內容還要想一點特殊的辦法,否則容易被截斷或者丟失格式。方法如下:打開瀏覽器的調試窗口,選中回復內容的區塊,編輯HTML,全選其中的代碼並複製,然後粘貼到wordpress的編輯窗口中,注意直接粘貼即可,wordpress的編輯窗口對輸入的html會進行自動處理。