我使用下面的docker-compose.yml
来保护我的版权巨魔。没有太多细节,它有一个名为pia_gluetun
的容器,用作其他容器的vpn连接。另一个容器名为pia_deluge
,它与所有其他容器沿着依赖于pia_gluetun
。
到目前为止一切顺利。现在所有其他容器都有各种depends_on
设置,以确保网络+数据源容器在媒体服务器容器之前启动。
然而,最后3次重启,我结束了所有的容器启动(大概是在正确的顺序,因为他们都工作,没有丢失服务的警告),除了pia_deluge
一个最终停止,没有日志-表明它的原因,甚至没有尝试启动(我想?)。随后启动它的工作完全正常。
version: '3.7'
services:
gluetun:
image: qmcgaw/private-internet-access
container_name: pia_gluetun
cap_add:
- NET_ADMIN
network_mode: bridge
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
- 8388:8388/udp # Shadowsocks
- 8000:8000/tcp # Built-in HTTP control server
# other containers ports
- 8112:8112 # deluge webui
- 58846:58846 # deluge daemon
- 6767:6767 # bazarr
- 8989:8989 # sonarr
- 7878:7878 # radarr
- 8686:8686 # lidarr
- 9117:9117 # jackett
- 8191:8191 # flaresolverr
- 4040:4040 # airsonic
- 8096:8096 # jellyfin
- 8227:8227 # pyload
volumes:
- ./data_gluetun:/gluetun
- ./data_gluetun/port_forward:/tmp/gluetun/forwarded_port
environment:
- VPNSP=private internet access
- TZ=${TIMEZONE}
- USER=${PIA_USER}
- PASSWORD=${PIA_PASS}
- REGION=${PIA_REGION}
- PORT_FORWARDING=on
- FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24
- HTTPPROXY=on
# - HTTPPROXY_USER=${PROXY_USER}
# - HTTPPROXY_PASSWORD=${PROXY_PASS}
- SHADOWSOCKS=on
- SHADOWSOCKS_PASSWORD=${SHADOW_PASS}
restart: unless-stopped
pyload:
image: linuxserver/pyload
container_name: pia_pyload
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_pyload:/config
- /shares/_Download:/downloads
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
deluge:
# image: linuxserver/deluge
build: ./deluge_my_image
container_name: pia_deluge
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
- DELUGE_LOGLEVEL=INFO #optional
volumes:
- ./config_deluge:/config
- /shares/media/_downloads:/downloads
# - /shares/media:/media
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
jackett:
image: linuxserver/jackett
container_name: pia_jackett
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_jackett:/config
- /shares/media/_downloads:/downloads
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
- flaresolverr
flaresolverr:
container_name: pia_flaresolverr
image: 'ghcr.io/flaresolverr/flaresolverr:latest'
environment:
- LOG_LEVEL=info
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
lidarr:
image: linuxserver/lidarr
container_name: pia_lidarr
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_lidarr:/config
- /shares/media:/media
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
- jackett
- deluge
radarr:
image: linuxserver/radarr
container_name: pia_radarr
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_radarr:/config
- /shares/media:/media
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
- jackett
- deluge
sonarr:
image: linuxserver/sonarr:preview
container_name: pia_sonarr
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_sonarr:/config
- /shares/media:/media
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
- jackett
- deluge
bazarr:
image: linuxserver/bazarr
container_name: pia_bazarr
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./config_bazarr:/config
- /shares/media:/media
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
- sonarr
- radarr
airsonic:
image: airsonicadvanced/airsonic-advanced:latest
container_name: pia_airsonic
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
- 'JAVA_OPTS=-Xmx1024m -Xms1024m'
volumes:
- ./config_airsonic:/var/airsonic
- /shares/media/music:/var/music
- ./playlists_airsonic:/var/playlists
- ./podcasts_airsonic:/var/podcast
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
jellyfin:
image: linuxserver/jellyfin
container_name: pia_jellyfin
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ./library_jellyfin:/config
- /shares/media:/media
- /shares/Dokumenty:/mnt/Dokumenty
# devices:
# - /dev/dri/renderD128:/dev/dri/renderD128
# network_mode: "host"
network_mode: "service:gluetun"
restart: unless-stopped
depends_on:
- gluetun
以我对这个问题的理解(当然是肤浅的),如果pia_deluge
容器没有启动,那不应该也阻止sonarr、radarr、lidarr启动吗?
我如何调整我的docker-compose.yml以确保所需的启动顺序?我以前尝试过将vpn容器作为堆栈外的单独容器,每次我重新创建它时,都会将通过它路由的容器搞砸。
非常感谢任何见解!
1条答案
按热度按时间wxclj1h51#
我是一个伟大的亡灵 Mage ,解决方案是正确实现healthcheck,然后扩展
depends_on
以依赖于service_healthy
而不是service_started
。在堆栈中设置容器,然后很容易像下面这样将它们相互链接,当重建堆栈时,容器将等待启动,直到它所依赖的容器是健康的,就像我2年前想要的那样: