Plex Setup
Media streaming service.
See Plex Docker and Documentation.
Ports
Plex Ports
Note
Using host networking will expose all of these ports. It may be better to
specify just 32400.
See Plex port usage.
Port
Protocol
Type
Purpose
32400
TCP
PUBLIC
Plex Media Server Access
1900
UDP
OPTIONAL
Plex DLNA Server
3005
TCP
OPTIONAL
Control Plex Home Theater w/ Plex Companion
5353
UDP
OPTIONAL
Bonjour/Avahi discovery
8324
TCP
OPTIONAL
Control Plex for Roku w/ Plex Companion
32410
UDP
OPTIONAL
GDM network discovery
32412
UDP
OPTIONAL
GDM network discovery
32413
UDP
OPTIONAL
GDM network discovery
32414
UDP
OPTIONAL
GDM network discovery
32469
TCP
OPTIONAL
Plex DLNA Server
Updated: None
Files
Plex Files
Location
Purpose
/config
Server configuration
/transcode
Transcoding directory
/tmp
Temp directory for transcoding
/data/media
Plex media server library
Updated: None
Docker Creation
You can copy your existing library from /var/lib/plexmediaserver/* to docker
/config directory to auto-import your existing plex library.
The UID/GID should be set to a user/group that have access to your media. All media clients should run under the same user to run correctly.
Map your media directly to where it was before on the docker container to prevent needing to modify any libraries. This should be read-only.
/transcodeneeds to be mapped to a fast drive. See Setup /transcode with tmpfs to run transcoding in memory.We additionally map the plex
/tmpdirectory to a subdirectory for the transcoding directory. Plex updated transcoding to split video encoding to/transcodewhile the audio encoding is transcoded in/tmp. This causes the EAE timeout! EAE not running, or wrong folder? Could not read Error. Moving/tmpfixes this.PLEX_CLAIMtoken is used to identify the server for your account. This is only used on initial startup without a pre-existing config. Generate a token here: https://www.plex.tv/claim.
plex:
image: plexinc/pms-docker:plexpass
restart: unless-stopped
network_mode: host
environment:
- CHANGE_CONFIG_DIR_OWNERSHIP=False
- PLEX_GID=1001
- PLEX_UID=1001
- PLEX_CLAIM={CLAIM TOKEN}
- TZ=America/Los_Angeles
volumes:
- /data/media:/data/media:ro
- /data/services/plexmediaserver:/config
- /etc/localtime:/etc/localtime:ro
- /tmp/Transcode/tmp:/tmp
- /tmp:/transcode
docker-compose stop plex
Setup /transcode with tmpfs
Transcoding is disk intensive and requires a fast (SSD or better) drive to make
latencies transparent. This will setup /tmp with tmpfs (running in memory)
to do transcoding in RAM, which will make playback and seeks nearly
instantanenous.
Create tmpfs on the docker host.
/etc/fstabtmpfs /tmp tmpfs defaults,size=4G 0 0
Note
Setup /tmp to use at most 4GB of RAM for storage (tmpfs only allocates
space from actual items stored).
Ensure that /transcode is set on the plex server to properly map to the
docker host /tmp directory.
Reboot to enable.
Enable Secure Server Connection
Ensure
32400is forwarded from the router.Enable DNS Rebinding on router.
If not using a plex claim token or manual port forwarding you may need to setup plex manually from the machine.
ssh -L 32400:{DOCKER HOST}:32400 -N {USER}@{DOCKER HOST}
docker-compose up -d plex