Mystery Conflicting Port Options Gluetun qBittorrent Sabnzbd

I am running into the following error message:

Error response from daemon: conflicting options: port publishing and the container type network mode

here is my docker compose

volumes:
  gluetunconfig:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/docker/pc/gluetun"
  qbittorrentconfig:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/docker/pc/qbittorrent"
  qbittorrentdata:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/data/torrents"
  sabnzbdconfig:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/docker/pc/sabnzbd"
  sabnzbddata:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/data/usenet"
  prowlarrconfig:
    driver_opts:
      type: cifs
      o: "username=hidden,password=hidden,vers=1.0"
      device: "//localip/docker/pc/prowlarr"

services:
  gluetun:
    image: qmcgaw/gluetun:latest
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    ports:
      - 8888:8888/tcp #HTTP proxy
      - 8388:8388/tcp #Shadowsocks
      - 8388:8388/udp #Shadowsocks
      - 8090:8090 #qBittorrent
      - 8191:8191 #flaresolverr
      - 9696:9696 #prowlarr
      - 8282:8282 #sabnzbd
    volumes:
      - gluetunconfig:/gluetun
    environment:
      - PUID=0 #CHANGE_TO_YOUR_UID
      - PGID=0 #CHANGE_TO_YOUR_GID
      - TZ=America/New_York #CHANGE_TO_YOUR_TZ
      - VPN_SERVICE_PROVIDER=private internet access
      - VPN_TYPE=openvpn
      - OPENVPN_USER=hidden
      - OPENVPN_PASSWORD=hidden
      - HTTPPROXY=off #change to on if you wish to enable
      - SHADOWSOCKS=off #change to on if you wish to enable
      - FIREWALL_OUTBOUND_SUBNETS=192.168.65.0/24,192.168.1.0/24 #change this in line with your subnet see note on guide.
#      - FIREWALL_VPN_INPUT_PORTS=12345 #uncomment this line and change the port as per the note on the guide
    network_mode: vpn
    labels:
      - com.centurylinklabs.watchtower.enable=false
    restart: always

  qbittorrent:
    image: linuxserver/qbittorrent:latest
    container_name: qbittorrent
    environment:
      - PUID=0 #CHANGE_TO_YOUR_UID
      - PGID=0 #CHANGE_TO_YOUR_GID
      - TZ=America/New_York #CHANGE_TO_YOUR_TZ
      - WEBUI_PORT=8090
      - UMASK=022
    volumes:
      - qbittorrentconfig:/config
      - qbittorrentdata:/torrents
    network_mode: service:gluetun # run on the vpn network
    depends_on:
      gluetun:
        condition: service_healthy
    restart: always

  sabnzbd:
    image: lscr.io/linuxserver/sabnzbd:latest
    container_name: sabnzbd
    environment:
      - PUID=0 #CHANGE_TO_YOUR_UID
      - PGID=0 #CHANGE_TO_YOUR_GID
      - TZ=America/New_York #CHANGE_TO_YOUR_TZ
    volumes:
      - sabnzbdconfig:/config
      - sabnzbddata:/data/usenet
    ports:
      - 8282:8282
    network_mode: service:gluetun # run on the vpn network
    depends_on:
      gluetun:
        condition: service_healthy
    restart: always

  linuxserver-prowlarr:
    image: linuxserver/prowlarr:latest
    container_name: prowlarr
    environment:
      - PUID=0 #CHANGE_TO_YOUR_UID
      - PGID=0 #CHANGE_TO_YOUR_GID
      - TZ=America/New_York #CHANGE_TO_YOUR_TZ
      - UMASK=022
    volumes:
      - prowlarrconfig:/config
    network_mode: service:gluetun # run on the vpn network
    depends_on:
      gluetun:
        condition: service_healthy
    restart: always
    
  flaresolverr:
    image: flaresolverr/flaresolverr:latest
    container_name: flaresolverr
    environment:
      - TZ=America/New_York #CHANGE_TO_YOUR_TZ
    network_mode: service:gluetun # run on the vpn network
    depends_on:
      gluetun:
        condition: service_healthy
    restart: always```

the issue is with Sabnzbd. All other services start and run perfectly fine. It’s just Sabnzbd. If I remove the service everything works. I have also run “netstat -a -n -p tcp -b” and confirmed none of the ports I pick are being used. I have tried all sorts of random ports and still get the same error message

Error response from daemon: conflicting options: port publishing and the container type network mode

any help would be greatly appreciated

I know this was posted 7 year ago but your issue is caused by you declaring the ports under the SABNzbd service, this needs to me removed and entered under the Gluetun service.

Just 8 months ago, but an answer can help anyone in the future.

Just to extend the answer, the port forwarding was not allowed in the sabnzbd service as it used the other container’s network so all port forwarding had to be defined there.