Docker如何用上宿主机的Clash代理
来源 https://williamlfang.github.io/2024-03-28-docker-%E4%BD%BF%E7%94%A8-host-%E4%BB%A3%E7%90%86/
问题描述:
al-folio 学术主页访问谷歌学术, 没有代理会报错
在 docker-compose.yml 文件里进行修改
加入
network_mode: host 和代理
如下:
version: "3"
# this file uses prebuilt image in dockerhub
services:
jekyll:
image: amirpourmand/al-folio:v0.12.0
build: .
network_mode: host
ports:
- 8080:8080
- 35729:35729
volumes:
- .:/srv/jekyll
environment:
- HTTP_PROXY=http://127.0.0.1:7897
- HTTPS_PROXY=http://127.0.0.1:7897
- NO_PROXY=localhost,127.0.0.1
Enjoy Reading This Article?
Here are some more articles you might like to read next: