Hi there!

I’m trying to set up two services (through docker) both of which use port 8080 by default. However I am wanting these to services to sit behind a VPN using Gluetun. I added both of the ports I want to use to the compose file, but this just leads to only one of the services working as the other one will say “port already in use”. How can I strictly tell these services what port they shall use in the compose file?

This is how I did it so far;

docker-compose.yml

---
version: '3'
services:
  vpn:
   image: qmcgaw/gluetun:latest
   container_name: vpn
   restart: unless-stopped
   cap_add:
    - NET_ADMIN
   environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - VPN_ENDPOINT_IP=####
      - VPN_ENDPOINT_PORT=####
      - WIREGUARD_PUBLIC_KEY=####
      - WIREGUARD_PRIVATE_KEY=####
      - WIREGUARD_PRESHARED_KEY=####
      - WIREGUARD_ADDRESSES=####
   devices:
    - /dev/net/tun:/dev/net/tun
   ports:
    - '8080:8080'
    #VPN
    - 8888:8888/tcp
    - 8388:8388/tcp
    - 8388:8388/udp
    - 8000:8000/tcp
    - 8584:8584
    - 8585:8585
   volumes:
    - /docker/appdata/gluetun:/gluetun
  sabnzbd:
    image: lscr.io/linuxserver/sabnzbd:latest
    container_name: sabnzbd
	network_mode: container:vpn
    volumes:
      - /docker/appdata/sabnzbd/data:/config
    restart: unless-stopped
  qbittorrent:  
    container_name: qbittorrent  
    image: linuxserver/qbittorrent:latest
    restart: unless-stopped
    network_mode: container:vpn  
    volumes:  
     - /docker/appdata/qbitorrent:/config  
  • webnet@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    qBittorrent has an option to define the WEBUI_PORT. If you want to access it on say, port 8585, set this environment variable to WEBUI_PORT=8585. Then in gluetun, continue to reference it as you do above. Hope this helps. https://registry.hub.docker.com/r/linuxserver/qbittorrent

      qbittorrent:  
        container_name: qbittorrent  
        image: linuxserver/qbittorrent:latest
        environment:
          - WEBUI_PORT=8585
        restart: unless-stopped
        network_mode: container:vpn  
        volumes:  
         - /docker/appdata/qbitorrent:/config  
    
    • Fjor@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      Ah thanks! That solves one of the services at least. Merciii <3