Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Containers started with docker compose disconnecting

Featured Replies

  • Author

here is the compose I have used.

it works, it stays connected and I can use the sonarr's connected to their databases, but again, when I run it with compose, they will eventually get Broken pipe and client disconnect errors. When I run it from the UI and set the network to arr_bridge they don't ever have such errors. I just want to know why Unraid has such trouble with compose sometimes. Immich has yet to experience it, but it has had the Broken pipe and client disconnect once or twice before resetting the network stack.

the arr_bridge was started with docker network create arr_bridge

compose.yaml

Edited by nate34k

  • Community Expert
56 minutes ago, nate34k said:

here is the compose I have used.

it works, it stays connected and I can use the sonarr's connected to their databases, but again, when I run it with compose, they will eventually get Broken pipe and client disconnect errors. When I run it from the UI and set the network to arr_bridge they don't ever have such errors. I just want to know why Unraid has such trouble with compose sometimes. Immich has yet to experience it, but it has had the Broken pipe and client disconnect once or twice before resetting the network stack.

the arr_bridge was started with docker network create arr_bridge

compose.yaml

OK, I'm going to Use AI to help reconstruct/rebuild the Compose just a FYI. to make sure pathing, configurations and other are correct...

Just to be clear:
You're seeing:

  • Broken pipe / client disconnect errors in Compose-deployed containers using PostgreSQL

  • No such issues when launching the same containers with the Unraid Docker UI

  • Your manual bridge arr_bridge works reliably when created via CLI

  • Problems mostly appear when Compose tries to recreate networks and containers

Why this may be happening:
Docker Compose recreating or conflicting with existing networks:

  • Compose tries to manage the network lifecycle unless marked external: true

  • This can cause unintended container restarts or disconnections on network changes

  1. Volume inconsistencies between /mnt/vm-zfs/ and /mnt/user/

    • /mnt/user/ uses FUSE (via Unraid's user-share system), which is notoriously flaky with databases (like PostgreSQL or SQLite) under heavy I/O

    • Preferred for PostgreSQL: Use /mnt/cache/ or /mnt/diskX/ paths directly if possible

  2. Network stack bugs in Unraid or Docker engine on Unraid

    • Some reports show Docker Compose + Unraid + custom bridge networks behave inconsistently over time (possibly due to iptables/dnsmasq interactions)

  3. Database readiness race conditions:

    • Even with depends_on and healthcheck, PostgreSQL may not be 100% ready for transactional connections

Here’s a cleaned-up, Unraid-optimized version of your Compose:

I assume your using my docker network from earlier...

we will use the Use external: true and pre-create the network

docker network create \

--driver=bridge \

--subnet=172.42.0.0/16 \

--gateway=172.42.0.1 \

arr_bridge

Compose Fixes


Additional Recommendations

  • Use /mnt/cache/... instead of /mnt/user/ for database containers to reduce FUSE latency and corruption risks

  • Use healthcheck + wait-for-it or dockerize for better DB readiness handling inside Sonarr

  • Monitor Unraid’s Docker engine logs: tail -f /var/log/docker.log for errors when the disconnects happen

The Turth is I don't know why you are runign 2 of the same docker 1 for HD and 1 for 4K that a bit weried and may alos intrdocue post conflgits as they are in the same bdige and bth are the same docker usingthe same ports...

Your better off seperateing the 4k and the HD if doin that in there 2 seperage docker networks and docker compses...
this is due to the fact that both docers are still using the same ports while you can change the host to conect into that docker brdge these dockers are fighting each other to who is asigned the port they are both using...

--This is why your expering network issues...

version: "3.8"

services:
  hd-web:
    image: lscr.io/linuxserver/sonarr
    container_name: hd-web
    restart: unless-stopped
    ports:
      - 8989:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr:/config
    networks:
      - arr_bridge

  4k-web:
    image: lscr.io/linuxserver/sonarr
    container_name: 4k-web
    restart: unless-stopped
    ports:
      - 9898:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-4k:/config
    depends_on:
      - 4k-web-postgresql
    networks:
      - arr_bridge

  4k-web-postgresql:
    image: postgres:14
    container_name: 4k-web-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-4k-web-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      - arr_bridge

  anime:
    image: lscr.io/linuxserver/sonarr
    container_name: sonarr-anime
    restart: unless-stopped
    ports:
      - 9899:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-anime:/config
    depends_on:
      - anime-postgresql
    networks:
      - arr_bridge

  anime-postgresql:
    image: postgres:14
    container_name: anime-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-anime-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    ports:
      - 5434:5432
    networks:
      - arr_bridge

  4k-remux:
    image: lscr.io/linuxserver/sonarr
    container_name: sonarr-4k-remux
    restart: unless-stopped
    ports:
      - 8979:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-4k-remux:/config
    depends_on:
      - 4k-remux-postgresql
    networks:
      - arr_bridge

  4k-remux-postgresql:
    image: postgres:16
    container_name: 4k-remux-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-4k-remux-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    command: >
      postgres -c checkpoint_timeout=30min -c max_wal_size=2GB
               -c min_wal_size=500MB -c checkpoint_completion_target=0.9
               -c wal_level=replica
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      - arr_bridge

networks:
  arr_bridge:
    external: true

Where My Ars stack runs... and compose is as such...

Following the Trash Guides for the ars stack:
https://trash-guides.info/File-and-Folder-Structure/How-to-set-up/Unraid/

-I have my compose build its own docker network and it uses 172.45
-I use transmision as I know the software and have other eidts to help with fiding content.

#version: "3.8"

networks:
  arrs:
    driver: bridge
    ipam:
      config:
        - subnet: 172.45.0.0/24

services:

  transmission:
    image: lscr.io/linuxserver/transmission
    container_name: transmission
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/transmission/config:/config
      - /mnt/vm-zfs/Dockers/arsdata/torrents:/downloads
      - /mnt/vm-zfs/Dockers/arsdata/torrents:/data/torrents
    ports:
      - "9091:9091"
#TCP and UDP for a secure port
    networks:
      arrs:
        ipv4_address: 172.45.0.2
    restart: unless-stopped

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:nightly
    container_name: prowlarr
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/prowlarr/config:/config
      - /mnt/vm-zfs/Dockers/arsdata:/data
    ports:
      - 9697:9696
    networks:
      arrs:
        ipv4_address: 172.45.0.3
    restart: unless-stopped

  #TV-Shows
  sonarr:
    image: lscr.io/linuxserver/sonarr:develop
    container_name: sonarr
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/sonarr/config:/config
      - /mnt/vm-zfs/Dockers/arsdata:/data
    ports:
      - 8989:8989
    networks:
      arrs:
        ipv4_address: 172.45.0.4
    restart: unless-stopped

#Movies
  radarr:
    image: lscr.io/linuxserver/radarr
    container_name: radarr
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/radarr/config:/config
      - /mnt/vm-zfs/Dockers/arsdata:/data
    ports:
      - 7878:7878
    networks:
      arrs:
        ipv4_address: 172.45.0.5
    restart: unless-stopped

#Music - Requires a private conenction
#  lidarr:
#    image: lscr.io/linuxserver/lidarr
#    container_name: lidarr
#    pull_policy: always
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"
#    environment:
#      - PUID=0
#      - PGID=0
#      - TZ=America/Chicago
#    volumes:
#      - /mnt/vm-zfs/Dockers/arsdata/lidarr/config:/config
#      - /mnt/vm-zfs/Dockers/arsdata:/data
#    ports:
#      - 8686:8686
#    networks:
#      arrs:
#        ipv4_address: 172.45.0.6
#    restart: unless-stopped

  readarr:
    image: lscr.io/linuxserver/readarr:develop
    container_name: readarr
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/readarr/config:/config
      - /mnt/vm-zfs/Dockers/arsdata:/data
    ports:
      - 8787:8787
    networks:
      arrs:
        ipv4_address: 172.45.0.7
    restart: unless-stopped

  bazarr:
    image: lscr.io/linuxserver/bazarr
    container_name: bazarr
    pull_policy: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Chicago
    volumes:
      - /mnt/vm-zfs/Dockers/arsdata/bazarr/config:/config
      - /mnt/vm-zfs/Dockers/arsdata:/data
    ports:
      - 6767:6767
    networks:
      arrs:
        ipv4_address: 172.45.0.8
    restart: unless-stopped

#CloudFlareCaptch - Dead
#  flaresolverr:
#    image: ghcr.io/flaresolverr/flaresolverr:latest
#    pull_policy: always
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"
#    container_name: flaresolverr
#    environment:
#      - LOG_LEVEL=info
#    ports:
#      - "8191:8191"
#    networks:
#      arrs:
#        ipv4_address: 172.45.0.9
#    restart: unless-stopped

^ - just as refference...

as the Ars setup needs a specfic file structure
On the host (unRAID) you will need to add /mnt/user before it. So /mnt/user/data

data
├── torrents
│   ├── books
│   ├── movies
│   ├── music
│   └── tv
├── usenet
│   ├── incomplete
│   └── complete
│       ├── books
│       ├── movies
│       ├── music
│       └── tv
└── media
    ├── books
    ├── movies
    ├── music
    └── tv


as I have this auto with My Plex...

so you need to make another docker network and separate the same dockers as 2 separate docker instance....

Edited by bmartino1
Removed PI

  • Community Expert

So this is the idea to make sure its not networking based. we will let compose make and use the bridge...

Goal:

  1. Two separate Compose files:

    • docker-compose.hd.yml (HD Sonarr only)

    • docker-compose.4k.yml (4K Sonarr + PostgreSQL containers)

  2. The network should be created by Compose if not present.

  3. Explicit static IPs for each container (to match your working setup).

  4. PostgreSQL containers with robust healthcheck.

  5. Direct /mnt/cache/... usage for PostgreSQL data to avoid fuse issues.

  6. No name collisions between containers (e.g. hd-web, 4k-web, anime, remux).

docker-compose.hd.yml

version: "3.8"

networks:
  arr_bridge:
    driver: bridge
    ipam:
      config:
        - subnet: 172.42.0.0/16
          gateway: 172.42.0.1

services:
  hd-web:
    image: lscr.io/linuxserver/sonarr
    container_name: hd-web
    restart: unless-stopped
    ports:
      - 8989:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr:/config
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.10

docker-compose.4k.yml

version: "3.8"

networks:
  arr_bridge:
    external: true

services:
  4k-web:
    image: lscr.io/linuxserver/sonarr
    container_name: 4k-web
    restart: unless-stopped
    ports:
      - 9898:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-4k:/config
    depends_on:
      - 4k-web-postgresql
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.11

  4k-web-postgresql:
    image: postgres:14
    container_name: 4k-web-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-4k-web-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.21

  anime:
    image: lscr.io/linuxserver/sonarr
    container_name: sonarr-anime
    restart: unless-stopped
    ports:
      - 9899:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-anime:/config
    depends_on:
      - anime-postgresql
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.12

  anime-postgresql:
    image: postgres:14
    container_name: anime-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-anime-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    ports:
      - 5434:5432
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.22

  4k-remux:
    image: lscr.io/linuxserver/sonarr
    container_name: sonarr-4k-remux
    restart: unless-stopped
    ports:
      - 8979:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-4k-remux:/config
    depends_on:
      - 4k-remux-postgresql
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.13

  4k-remux-postgresql:
    image: postgres:16
    container_name: 4k-remux-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/postgres-sonarr-4k-remux-db:/var/lib/postgresql/data
      - ./init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
    command: >
      postgres -c checkpoint_timeout=30min -c max_wal_size=2GB
               -c min_wal_size=500MB -c checkpoint_completion_target=0.9
               -c wal_level=replica
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      arr_bridge:
        ipv4_address: 172.42.0.23

This should fix the issues your are having. You may need to delete any exisint names of docker bridges that exisit int eh IP subnet thesse compose are using...

or change names and subnets in teh compose files...

  • Community Expert

looking at it more it apears you have 3 ... not 2 and i'm not going to do teh work to make 3 composes with the data at hand.. you know the gist. All I can say is simplfiy it down make 1 first and run and add with exiting true to have them all in the same docker net and stay interconnected...

sonar and its postgress in HD, anime, 4k etc....

trying to do tomuch with the same dokcer in teh same network... ports in use and I don't have a good soultion without hevily editing compose and usign custum br0 and assigning lan ips to the dockers...

  • Community Expert

image.png

docker-compose.hd.yml

version: "3.8"

networks:
  hd_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.44.1.0/24
          gateway: 172.44.1.1

services:
  hd-sonarr:
    image: lscr.io/linuxserver/sonarr
    container_name: hd-sonarr
    restart: unless-stopped
    ports:
      - 8989:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-hd:/config
    depends_on:
      - hd-db
    networks:
      hd_net:
        ipv4_address: 172.44.1.10

  hd-db:
    image: postgres:14
    container_name: hd-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=sonarr
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/sonarr-hd-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      hd_net:
        ipv4_address: 172.44.1.11

docker-compose.4k.yml

version: "3.8"

networks:
  uhd_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.44.2.0/24
          gateway: 172.44.2.1

services:
  uhd-sonarr:
    image: lscr.io/linuxserver/sonarr
    container_name: uhd-sonarr
    restart: unless-stopped
    ports:
      - 9898:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-4k:/config
    depends_on:
      - uhd-db
    networks:
      uhd_net:
        ipv4_address: 172.44.2.10

  uhd-db:
    image: postgres:16
    container_name: uhd-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=sonarr
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/sonarr-4k-db:/var/lib/postgresql/data
    command: >
      postgres -c checkpoint_timeout=30min -c max_wal_size=2GB
               -c min_wal_size=500MB -c checkpoint_completion_target=0.9
               -c wal_level=replica
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      uhd_net:
        ipv4_address: 172.44.2.11

docker-compose.anime.yml

version: "3.8"

networks:
  anime_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.44.3.0/24
          gateway: 172.44.3.1

services:
  anime-sonarr:
    image: lscr.io/linuxserver/sonarr
    container_name: anime-sonarr
    restart: unless-stopped
    ports:
      - 9797:8989
    environment:
      - PUID=99
      - PGID=100
      - UMASK=022
    volumes:
      - /mnt/user/data/:/data
      - /mnt/user/appdata/sonarr-anime:/config
    depends_on:
      - anime-db
    networks:
      anime_net:
        ipv4_address: 172.44.3.10

  anime-db:
    image: postgres:14
    container_name: anime-postgresql
    restart: unless-stopped
    environment:
      - POSTGRES_DB=sonarr
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=redacted
    volumes:
      - /mnt/cache/appdata/sonarr-anime-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 10
    networks:
      anime_net:
        ipv4_address: 172.44.3.11
  • Author
  • Solution

Hi, I have been testing some things. My cache drive was set to ZFS with the default settings Unraid gives it. I moved all my data off cache with mover, formatted it to XFS, moved all the data back onto it, and now I am testing my various compose stacks from the original configuration, where they were running and managed with Dockge. It's been over 12 hours now and all database containers are running with no errors or disconnects, and containers that use sqlite databases in appdata show no locking errors either, which was also an issue before, though a smaller issue.

I will continue to monitor and if I am stable in this configuration for 48 more hours think it's safe to attribute this to using a poorly tuned ZFS cache drive.

Edited by nate34k

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.