2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-11-05 09:26:22 +00:00
plex-media-server/README.md
Joe Groocock f01f4950ab
Build Plex on musl, from scratch
Plex now provide a first-party musl Plex build that works without any
external dependencies whatsoever. It's built with LLVM with many
compiler and linker optimisations enabled:
https://forums.plex.tv/t/plex-media-server-forum-preview-faster-and-smaller-builds-with-new-toolchain/699575

Restructure build into multiple distinct Docker build stages to better
leverage caching and significantly improve build time on multicore
systems with BuildKit, particularly with LTO enabled.

Changes for this release include:
- Build `FROM spritsail/alpine` instead of `FROM debian` to ensure musl
  compatibility with all compiled binaries. Use `FROM scratch` for the
  resulting image. ld-musl is provided by Plex.
- Build busybox, su-exec and tini as they're no longer provided by the
  base image.
- Build binaries/libraries with standard hardening flags, including the
  popular -flto.

Signed-off-by: Joe Groocock <me@frebib.net>
2021-05-28 10:12:19 +00:00

5.2 KiB

spritsail/plex-media-server

Layers Latest Version Git Commit Docker Pulls Docker Stars Build Status Last Build

The smallest* Plex Media Server docker image, built FROM scratch with musl provided by Plex and supporting libraries and binaries built from source. The container hosts a fully featured Plex Media Server, with almost all of the useless crap removed, resulting in the smallest container possible whilst maintaining full functionality.

*last we checked

Getting Started

Navigate to plex.tv/claim and obtain a token in the form claim-xxxx...

Start the container, as demonstrated below, passing the claim token via the PLEX_CLAIM environment variable. This only has to be present on the first run (when the configuration is generated/if you need to re-claim the server at any time) and can be removed for subsequent runs. The Plex claim token is optional however it will make the server available to your account immediately.

Setting the container hostname on first boot will set the Plex server name.

docker run -dt \
    --name=plex \
    --restart=unless-stopped \
    --hostname=my-plex-server \
    -p 32400:32400 \
    -e PLEX_CLAIM=claim-xxxx... \
    -v /config/plex:/config \
    -v /transcode:/transcode \
    -v /media:/media \
    spritsail/plex-media-server

Finally, navigate to app.plex.tv/desktop or your-ip:32400/web and you're done!

Volumes

  • /config - Configuration, logs, caches and other Plex crap. You should keep this
  • /transcode - Transcoder temporary directory. This should be backed by fast storage, ideally tmpfs/RAM.
  • Don't forget to mount your media (tv-shows/movies) inside the container too!

Environment

  • $SUID - User ID to run as default: 900
  • $SGID - Group ID to run as default: 900
  • $ALLOWED_NETWORKS - IP/netmask entries which allow access to the server without requiring authorization. We recommend you set this only if you do not sign in your server. For example 192.168.1.0/24,172.16.0.0/16 will allow access to the entire 192.168.1.x range and the 172.16.x.x range.
  • $ADVERTISE_IP - This variable defines the additional IPs on which the server may be be found. For example: http://10.1.1.23:32400. This adds to the list where the server advertises that it can be found.
  • $DISABLE_REMOTE_SEC -
  • $PLEX_CLAIM - The claim token for the server to obtain a real server token. If not provided, server will not be automatically logged in. If server is already logged in, this parameter is ignored.
  • $LOG_DEBUG - Disables debug logging if set to 0, and enables it if set to 1. This overwrites preferences set in the Plex Web user interface.
  • $LOG_VERBOSE - Disables logging (except warnings and errors) if set to 0, and enables it if set to 1. This overwrites preferences set in the Plex Web user interface.

Network

The following ports are all used by Plex for various applications

  • 32400/tcp Plex Web/Client Access
  • 5353/udp Bonjour/Avahi
  • 3005/tcp Plex Home Theatre via Plex Companion
  • 8324/tcp Plex for Roku via Plex Companion
  • 1900/udp Plex DLNA Server
  • 32469/udp Plex DLNA Server
  • 32410/udp GDM network discovery
  • 32412/udp GDM network discovery
  • 32413/udp GDM network discovery
  • 32414/udp GDM network discovery

See also: https://support.plex.tv/articles/201543147-what-network-ports-do-i-need-to-allow-through-my-firewall/

At the very least, you should expose 32400/tcp to your network, and port forward it through your router if you would like Plex access outside your home network.

If you wish, you can map the Plex port to any other port outside your network, just be sure to update the port in Settings > Server > Remote Access (Show Advanced) under Manually specify public port.

Troubleshooting

  • Help, I accidentally logged my server out and I can no longer access it Just get another claim token from plex.tv/claim and restart the container with it in the environment variable PLEX_CLAIM. This should re-claim your server and it'll appear in your server list once again. You can remove the claim token as soon as the server has been claimed- they expire after 5 minutes anyway