组成一个声明traefik反向代理的容器:
reverse-proxy:
image: traefik:v2.0
container_name: "traefik"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
还有一个plex服务:
plex:
image: linuxserver/plex
container_name: plex
labels:
- "traefik.enable=true"
- "traefik.http.routers.plex.rule=Host(`plex.baptiste-arnaud.fr`)"
- "traefik.http.routers.plex.entrypoints=web"
- "traefik.http.services.plex.loadbalancer.server.port=32400"
network_mode: host
environment:
- PUID=1000
- PGID=1000
- VERSION=docker
volumes:
- /home/pi/hdd1/plex/library:/config
- /home/pi/hdd1/plex/tvshows:/tv
- /home/pi/hdd1/plex/movies:/movies
restart: unless-stopped
它使用host network
模式。我尝试请求plex.baptiste-arnaud.fr
,它给了我一个“错误的网关”。我还有其他运作良好的服务。当容器与主机网络一起启动时,它可以工作吗?