For the purpose of this how to we will use the Linuxserver.io Plex image.

The above docker-compose.yml requires you to fill in the UID and GID for the Plex user Plex will run as. Typically this is 1000 and 1000 respectively if your the first user created on Ubuntu or Raspberry Pi OS.

You will need to edit the file to specify the path to your TV shows and Movies. Defaults to the users home directory of $HOME/docker/plex.

You will need to get a Plex claim token at https://www.plex.tv/claim if you are running headless.

mkdir $HOME/docker/plex
cd $HOME/docker/plex
wget https://gist.githubusercontent.com/slochewie/6d8ba7dc18ca7e927d87c5ca3bbb8e97/raw/15c88c1963e2c18dc695f76d6d3a15b4cb7bffeb/docker-compose.yml
docker-compose pull
docker-compose up -d