Clone the repo, run the host bootstrap, edit .env, then run the smart installer/updater:
git clone https://github.com/c2theg/plex_ubuntu_containers.git
cd plex_ubuntu_containers
sudo ./bootstrap-ubuntu-24.04.sh
cp -n .env.example .env
nano .env
./install_update.shAfter that, the server will:
- install and run Plex, Sonarr, Radarr, and SABnzbd with Docker Compose
- auto-update Ubuntu every Sunday at 3:00 AM
- auto-update the media stack every Sunday at 3:30 AM
- prune old config backups every Sunday at 3:45 AM
- check service health every 15 minutes and restart/recreate services if needed
- check disk usage daily at 2:15 AM
- reboot at 2:00 AM once uptime reaches the configured threshold
Docker Compose based Plex, Sonarr, Radarr, and SABnzbd stack for Ubuntu Server 24.04.
This repo is designed for a low-touch home server:
- keep config and media data outside the containers
- pull newer images and recreate containers instead of upgrading inside them
- back up app config before updates
- prune old backups automatically
- self-check service health and restart failed containers
- watch disk usage and log warnings
- install scheduled OS, container, and reboot maintenance jobs
compose.yml— container definitions.env.example— environment variables and path template.gitignore— excludes.env, local overrides, and temporary filesbootstrap-ubuntu-24.04.sh— one-time Ubuntu host prepinstall_update.sh— easiest entrypoint, runs install or update automaticallymanage-media-stack.sh— manual lifecycle commandssetup-cron.sh— idempotent cron installerhealth-monitor.sh— host-side service health checks with auto-restartdisk-space-check.sh— disk usage monitor with optional email alertsreboot-if-needed.sh— reboots only when uptime reaches the configured threshold
git clone https://github.com/c2theg/plex_ubuntu_containers.git
cd plex_ubuntu_containers
sudo ./bootstrap-ubuntu-24.04.sh
cp -n .env.example .env
nano .env
./install_update.sh-
bootstrap-ubuntu-24.04.sh- installs Docker, Docker Compose plugin, cron, curl, and common dependencies
- enables Docker and cron
- creates
.envfrom.env.exampleif missing - installs the recurring cron jobs
-
Edit
.env- set your host paths
- optionally set
PLEX_CLAIM - optionally set
ALERT_EMAIL
-
install_update.sh- ensures Docker exists
- ensures cron jobs exist
- runs
installif this is a new deployment - runs
updateif the stack already exists
./manage-media-stack.sh install
./manage-media-stack.sh update
./manage-media-stack.sh status
./manage-media-stack.sh logs
./manage-media-stack.sh backup
./manage-media-stack.sh prune-backups
./manage-media-stack.sh restart
./manage-media-stack.sh stop
./manage-media-stack.sh check- Sunday 3:00 AM — Ubuntu updates
- Sunday 3:30 AM — media stack update
- Sunday 3:45 AM — old backup pruning
- Every 15 minutes — service health monitor
- Daily 2:00 AM — reboot if uptime is at least
REBOOT_AFTER_DAYS - Daily 2:15 AM — disk usage check
In addition to the main path settings, you can tune these:
BACKUP_RETENTION_DAYS=30
REBOOT_AFTER_DAYS=30
DISK_ALERT_THRESHOLD=90
ALERT_EMAIL=If ALERT_EMAIL is set and a local mailer is available, disk warnings are emailed as well as logged.
TZ=America/New_York
PUID=1000
PGID=1000
APP_DATA=/media/apps/configs
MEDIA_MOVIES=/media/media_movies
MEDIA_TV=/media/media_tv
MEDIA_MUSIC=/media/media_music
MEDIA_VIDEOS=/media/media_videos
MEDIA_PHOTOS=/media/media_photos
MEDIA_DOWNLOADS=/media/media_downloads
TEMP_DOWNLOADS=/media/temp_downloads
REMOTE_SHARE_01=/mnt/remote_share_01
REMOTE_SHARE_02=/mnt/remote_share_02
PLEX_CLAIM=
PLEX_ADVERTISE_URL=
BACKUP_RETENTION_DAYS=30
REBOOT_AFTER_DAYS=30
DISK_ALERT_THRESHOLD=90
ALERT_EMAIL=For first-time server setup, place your claim token in:
PLEX_CLAIM=claim-xxxxxxxxxxxxAfter the server is claimed and working, you can usually clear that value.
The Plex container maps /dev/dri:/dev/dri, which is typically what you want for Intel iGPU transcoding on Ubuntu.
The management script checks whether REMOTE_SHARE_01 and REMOTE_SHARE_02 are mounted before updates.
If you use SMB or NFS, configure those separately in /etc/fstab or your preferred mount process.
disk-space-check.sh checks the main app and media paths using df. When usage reaches DISK_ALERT_THRESHOLD, it writes warnings to the cron log. If ALERT_EMAIL is set, it will also attempt to send an email.
health-monitor.sh checks that the containers are running and performs simple HTTP checks against Plex, Sonarr, Radarr, and SABnzbd. If a service is down or unhealthy, it runs docker compose up -d <service> to recreate it.
Do not remove your app config directories unless you intentionally want to reset the apps.
Important paths:
${APP_DATA}/plex/library${APP_DATA}/radarr/data${APP_DATA}/sonarr/data${APP_DATA}/sabnzbd/config