jaymoulin / docker-plex

Plex Media Server - Docker Image (Multiarch + Raspberry Pi) - 5M downloads
https://brands.jaymoulin.me/me/docker-plex
MIT License
97 stars 17 forks source link

Docker container in restart loop #18

Closed badokun closed 5 years ago

badokun commented 5 years ago

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

jaymoulin commented 5 years ago

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.

badokun commented 5 years ago

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.

jaymoulin commented 5 years ago

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

badokun commented 5 years ago

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.

badokun commented 5 years ago

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

jaymoulin commented 5 years ago

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

badokun commented 5 years ago

1.14.1

jaymoulin commented 5 years ago

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

badokun commented 5 years ago

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.

jaymoulin commented 5 years ago

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.

badokun commented 5 years ago

Yea let me give that a go