Open Wobak opened 4 months ago
Connect all the container instances of transmission to the gluetun network, name each container differently, and forward the ports needed by transmission containers to different external ports. List those ports under gluetun container's environment instead of each transmission instance though.
It's easiest if you're using docker compose
network_mode: service:gluetun
adds each container to gluetun network
container_name: WHATEVER_NAME
names the container instances
and set EXTERNAL_PORT:INTERAL_PORT
under gluetun environment, check example below. The external ports need t be different or they'll interfere with each other, they can have the same internal port though
for example using the Linuxserver.io transmission container
version: "3"
services:
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports: # External:Internal
- 9091:9091 # Transmission1 WebUI - the default; has same external & internal docker port; webUI on 9091
- 51413:51413 # Transmission1 torrent port - default
- 51413:51413/udp # Transmission1 UDP torrent port - default
- 9092:9091 # Transmission2 WebUI - forwarded external port; webUI is on port 9092
- 51414:51413 # Transmission2 torrent port (forwarded to 51414)
- 51414:51413/udp # Transmission2 UDP torrent port (forwarded to 51414)
- 9093:9091 # Transmission3 WebUI - forwarded external; webUI on port 9093
- 51415:51413 # Transmission2 torrent port (forwarded to 51415)
- 51415:51413/udp # Transmission2 UDP torrent port (forwarded to 51415)
volumes:
- /yourpath:/gluetun
environment:
- VPN_SERVICE_PROVIDER=yourvpn
- VPN_TYPE=openvpn
...etc etc
transmission1:
container_name: transmission1
image: lscr.io/linuxserver/transmission:latest
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ:-America/Los_Angeles}
volumes:
- /path/to/data:/config
- /path/to/downloads:/downloads
- /path/to/watch/folder:/watch
network_mode: service:gluetun
restart: unless-stopped
transmission2:
container_name: transmission2
image: lscr.io/linuxserver/transmission:latest
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ:-America/Los_Angeles}
volumes:
- /path/to/data:/config
- /path/to/downloads:/downloads
- /path/to/watch/folder:/watch
network_mode: service:gluetun
restart: unless-stopped
transmission3:
container_name: transmission3
image: lscr.io/linuxserver/transmission:latest
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ:-America/Los_Angeles}
volumes:
- /path/to/data:/config
- /path/to/downloads:/downloads
- /path/to/watch/folder:/watch
network_mode: service:gluetun
restart: unless-stopped
Docker compose has a scale and replicas option too where you don't have to put the transmission container description multiple times and name each one. But since the ports get listed under gluetun instead of transmission i'm not sure if that works here, haven't tried it.
How do you know which port will be redirected to which container ?
How do you tell gluetun that 9092 has to go to transmission2 and not transmission3?
@salemaziel ? Sorry to ping you directly :)
Following as well since when I tested a variation on this, it didn't work as I expected. All the port mapping went to one container instead of the other 3 (I tried 4 different ones).
Following here, too.
My best workaround is to have a gluetun instance for each container, since it's not feasible to alter each container image to have a different port. Obviously this creates more overhead than I think it's worth, and it also requires multiple simultaneous connections to the VPN server which may not work depending on your provider.
It could just be that the image i'm trying to duplicate isn't set up to use custom ports and use a service network setting, seems to be either-or.
I found a workaround that works for qbittorrent (not transmission but it's another linuxserver.io image):
this change persists between restarts/updates. others have had success with stacked compose files with all instances included that list gluetun services last, but I haven't tried that myself.
Hello,
I want to be able to run multiple transmission containers behind a gluetun vpn to make sure all their traffic will be redirected there, but I can't find a simple way to do this, and I don't want to run one gluetun per transmission container.
Is there a simple way to get this to work?
Thanks,