Docker / TrueNAS · April 27, 2021

Plex containerized, with NFS mounts!

In this episode, I’ll show you how to properly mount NFS shares directly inside your container config, rather than from the underlying host! This moves the mount dependency of your container stack in to your defined configuration file, and is one less thing your underlying hosts need to do, making your Docker hosts more vanilla and stateless. Check it out! Below is the example code.

version: "3.4"

volumes:
plex_plex-data:
external: true

tv-shows:
name: tv-shows
driver_opts:
type: nfs
o: addr=192.168.2.26,nolock,soft,ro
device: :/mnt/RAID5/TV
movies:
name: movies
driver_opts:
type: nfs
o: addr=192.168.2.26,nolock,soft,ro
device: :/mnt/RAID5/Movies
music:
name: music
driver_opts:
type: nfs
o: addr=192.168.2.26,nolock,soft,ro
device: :/mnt/RAID5/General/Music

services:
plex:
image: "linuxserver/plex:latest"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5

ports:
- 32400:32400
- 32400:32400/udp
- 32469:32469
- 32469:32469/udp
- 5353:5353/udp
- 1900:1900/udp

volumes:
- plex_plex-data:/config
- tv-shows:/media/TV
- movies:/media/Movies
- music:/media/Music

environment:
- TZ=America/Phoenix
- PUID=0
- PGID=0