Free media server compose example for Jellyfin.
Educational example only. Review every volume path, port, and credential before you run this. Do not copy production secrets into your wiki or git repo.
_shared/.env for non-secrets, _shared/.secret for credentialsmkdir -p /path/to/docker/stacks/jellyfin
cd /path/to/docker/stacks/jellyfin
# paste compose.yaml below, then:
docker compose pull
docker compose up -d
---
services:
###########################################################################
## Docker Compose File: Jellyfin (LinuxServer.io)
## Function: Media Server
## Documentation: https://jellyfin.org/docs/general/administration/installing#docker
## https://jellyfin.org/docs/general/administration/hardware-acceleration/
###########################################################################
jellyfin:
image: jellyfin/jellyfin:latest
container_name: jellyfin
hostname: jellyfin
env_file:
- /path/to/docker/stacks/_shared/.env
- /path/to/docker/stacks/_shared/.secret
environment:
- COMICVIN_BASEURL=#optional
- NVIDIA_VISIBLE_DEVICES=all # Tells the NVIDIA Container Toolkit to expose all available NVIDIA GPUs to the container
- NVIDIA_DRIVER_CAPABILITIES=all
- ROC_ENABLE_PRE_VEGA=1 # Hardware Acceleration
logging:
driver: json-file
options:
max-file: ${DOCKERLOGGING_MAXFILE:-10} # Max number of log files
max-size: ${DOCKERLOGGING_MAXSIZE:-200k} # Max file size
healthcheck:
test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8096' || exit 1
interval: 10s
timeout: 5s
retries: 3
start_period: 90s
volumes:
- /path/to/docker/data/jellyfin/config:/config # Path to your config directory
- /path/to/docker/data/jellyfin/cache:/cache # Path to your cache directory
- /path/to/data/media:/data/media:rw
#- /path/to/photo/photos/library:/photos:rw # Path to your photos, :ro for read-only :rw for read-write
- /dev/shm:/data/transcode # optional: enable transcoding in RAM. uncomment this line.
devices: # optional: hardware transcoding uncomment this line.
- /dev/dri:/dev/dri # optional: hardware transcoding uncomment this line.
#ports:
#- 8096:8096 # Jellyfin Web UI
#- 8920:8920 # Jellyfin DNLA (optional)
#- 7359:7359/udp # Jellyfin DLNA discovery
#- 1900:1900/udp # Jellyfin DLNA advertising
runtime: nvidia # Specify NVIDIA runtime for GPU access
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all # Use all available NVIDIA GPUs
capabilities: [gpu, utility, video] # Specify required capabilities
network_mode: host
#sysctls:
#- net.ipv6.conf.all.disable_ipv6=1
restart: unless-stopped
#
# curl --compressed "http://hdhomerun.com" > /path/to/docker/stacks/scripts/tv/tvguide.xml
# https://github.com/iptv-org/iptv#playlists
# http://assnat.qc.ca
# https://www.reddit.com/r/canadacordcutters/comments/cmg81g/free_and_legal_live_streams_from_canada/