jaymoulin/docker-plex

Docker container in restart loop

badokun opened this issue · 11 comments

Description

Docker container restarts on a 1 minute interval. Logs indicate

rm: can't remove '/root/Library/Application Support/Plex Media Server/plexmediaserver.pid': No such file or directory
6 3000 /root/Library/Application Support
8192

Steps to reproduce the issue:

  1. docker run -d --restart=always --name plex -v /mnt/usbdrive:/media --net=host jaymoulin/plex
  2. docker ps

Describe the results you received:
Plex appears to be running but in an infinite restart loop

Describe the results you expected:
The docker container should run without restarting

The error message means Plex is already running. If your 100% sure that you don't have any other Plex instance (can be a real one or another docker container) then delete your plexmediaserver.pid file which should located in the path you mounted as a volume.

To be sure I removed my current installation altogether, with docker rm plex and docker rmi xxxxx. Even removed the dangling volume with docker system prune --volumes

After I recreated the container, I ran docker inspect plex which showed me where the /root/Library folder is mapped to. In my case /var/lib/docker/volumes/40496bd9ff0ae85e040c4db0791ee16c742ed8f9eb4d81b302f6e1617215c01a/_data

When I cd into that folder (after running sudo su) this is what I see

root@xxxx:/var/lib/docker/volumes/40496bd9ff0ae85e040c4db0791ee16c742ed8f9eb4d81b302f6e1617215c08b/_data/Application Support/Plex Media Server# ls
Cache  Codecs  Crash Reports  Logs  Plug-in Support  Preferences.xml

There's no plexmediaserver.pid.

You don't have to do that.
README.md says

You can change the Plex Library directory by plugin your local folder to /root/Library folder

which you probably did. In the mounted volume (README.md says /mnt/usbdrive but you probably set yours), you'll find a path to your plexmediaserver.pid : </mnt/usbdrive>/Application Support/Plex Media Server/plexmediaserver.pid

I recreated the container by running

docker run -d --restart=always --name plex -v /mnt/hdd/plex_server/media:/media --net=host -v /mnt/hdd/plex_server/library:/root/Library jaymoulin/plex

Here's what I see

admin@xxx:/mnt/hdd/plex_server/library/Application Support/Plex Media Server $ ls
Cache  Codecs  Crash Reports  Logs  Plug-in Support  Preferences.xml

I dont see the pid file ever being created.

It has write permissions since the library and media folders where created on startup

What does docker inspect plex --format='{{index .Config.Labels.version}}' returns?

1.14.1

What is your return of docker images | grep plex? I mean, are you running on a PC/Rpi/Nas?

Running on a raspberry pi

jaymoulin/plex         latest              d793cd2ce3c1        7 weeks ago         200MB

I would expect all users to see the same behavior if they looked. The docker image restarts very quickly so may not be noticeable.

No user is affected by your issue which means something on your side is not behaving as expected. Maybe you can try without mounting your configuration volume so Plex will recreate its configuration from scratch.

Yea let me give that a go