Docker: Loosing remote connection and port forward settings on restart of container

Server Version#:
(ThinkStation P500 → Proxmox VE 7.3-6 → debian 11 (bullseye) → portainer 2.17 → Linxusserver - Plex Latest )
Media Stored on Synology 918+ SMB Share.
VM image also stored on NAS different share.

on prior to restart of Plex container the working remote access enabled and custom port where set and functioning.

every time I restart container only those two settings are lost al remaining settings are persisted… SO I need to go into the plex media web console and settings and turn on remote access then wait and then set the port to the correct port and everything works fine.

Would really like to not have to do that. The VM in my Lab can be up and down on a drop of the hat.

info on docker:
I have two volumes mounted one for config and the other for media.

Post your .yml file you used to create the container or stack.

Thank.

First I am not using a compose file (me idiot). So I have here the overly long Inspect output
I should spend the time to learn docker compose YML a Cool feature for Portainer would be to manufacture yml files from UI container builds.

{
“AppArmorProfile”: “docker-default”,
“Args”: ,
“Config”: {
“AttachStderr”: false,
“AttachStdin”: false,
“AttachStdout”: false,
“Cmd”: null,
“Domainname”: “”,
“Entrypoint”: [
“/init”
],
“Env”: [
“DEBIAN_FRONTEND=noninteractive”,
“HOME=/root”,
“LANG=en_US.UTF-8”,
“LANGUAGE=en_US.UTF-8”,
“LSIO_FIRST_PARTY=true”,
“NVIDIA_DRIVER_CAPABILITIES=compute,video,utility”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”,
“PGID=0”,
“PLEX_ARCH=amd64”,
“PLEX_DOWNLOAD=https://downloads.plex.tv/plex-media-server-new”,
“PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/config/Library/Application Support”,
“PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver”,
“PLEX_MEDIA_SERVER_INFO_DEVICE=Docker Container (LinuxServer.io)”,
“PLEX_MEDIA_SERVER_INFO_VENDOR=Docker”,
“PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6”,
“PLEX_MEDIA_SERVER_USER=abc”,
“PUID=0”,
“S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0”,
“S6_STAGE2_HOOK=/docker-mods”,
“S6_VERBOSITY=1”,
“TERM=xterm”,
“TZ=America/Toronto”
],
“ExposedPorts”: {
“1900/udp”: {},
“3005/tcp”: {},
“32400/tcp”: {},
“32410/udp”: {},
“32412/udp”: {},
“32413/udp”: {},
“32414/udp”: {},
“32469/tcp”: {},
“5353/udp”: {},
“8324/tcp”: {}
},
“Hostname”: “plex01”,
“Image”: “linuxserver/plex:latest”,
“Labels”: {
“build_version”: “Linuxserver.io version:- 1.31.1.6733-bc0674160-ls154 Build-date:- 2023-02-27T12:52:05-06:00”,
“maintainer”: “thelamer”,
“org.opencontainers.image.authors”: “linuxserver.io”,
“org.opencontainers.image.created”: “2023-02-27T12:52:05-06:00”,
“org.opencontainers.image.description”: “Plex organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. has always been a top priority. Straightforward design and bulk actions mean getting things done faster.”,
“org.opencontainers.image.documentation”: “linuxserver/plex - LinuxServer.io”,
“org.opencontainers.image.licenses”: “GPL-3.0-only”,
“org.opencontainers.image.ref.name”: “351eeae2ab5bc07129007edbfa361b1fcf428a6b”,
“org.opencontainers.image.revision”: “351eeae2ab5bc07129007edbfa361b1fcf428a6b”,
“org.opencontainers.image.source”: “GitHub - linuxserver/docker-plex”,
“org.opencontainers.image.title”: “Plex”,
“org.opencontainers.image.url”: “Packages · linuxserver/docker-plex · GitHub”,
“org.opencontainers.image.vendor”: “linuxserver.io”,
“org.opencontainers.image.version”: “1.31.1.6733-bc0674160-ls154”
},
“OnBuild”: null,
“OpenStdin”: false,
“StdinOnce”: false,
“Tty”: false,
“User”: “”,
“Volumes”: {
“/config”: {},
“/media”: {}
},
“WorkingDir”: “/”
},
“Created”: “2023-03-14T19:10:20.158350629Z”,
“Driver”: “overlay2”,
“ExecIDs”: null,
“GraphDriver”: {
“Data”: {
“LowerDir”: “/var/lib/docker/overlay2/49a3979dcd7ac3caea892a10eec65a442f2574f3cb9c32a4a2d333b4002e9e6c-init/diff:/var/lib/docker/overlay2/8d6da47d4e6cbe00f540eb1d96ee49e00464b597872069b4318b80af464ad72e/diff:/var/lib/docker/overlay2/e9a01ed764a3bddd73229807c68a782c02c264d6c89218ad300786507c47dffd/diff:/var/lib/docker/overlay2/e3c531da08d4e889761c2dde26ab0945be9a3d32c69c672f7d5006061497258b/diff:/var/lib/docker/overlay2/7d38c7fd166286b18d1b3654fc50e2c5327431829c7025a2f3d9188c6ec64339/diff:/var/lib/docker/overlay2/79d690a327267667b6d0b8094e820a92fc07e0aed5455993bc45617c249d3bfb/diff:/var/lib/docker/overlay2/1818b8fd44ed9b1c204755988f75e6acd462379aa0ebf35ff4607a247b184372/diff:/var/lib/docker/overlay2/ecf1a928bbfe17aed8adf24f66a1782be0d7a8992ca667acd221e498e406d960/diff”,
“MergedDir”: “/var/lib/docker/overlay2/49a3979dcd7ac3caea892a10eec65a442f2574f3cb9c32a4a2d333b4002e9e6c/merged”,
“UpperDir”: “/var/lib/docker/overlay2/49a3979dcd7ac3caea892a10eec65a442f2574f3cb9c32a4a2d333b4002e9e6c/diff”,
“WorkDir”: “/var/lib/docker/overlay2/49a3979dcd7ac3caea892a10eec65a442f2574f3cb9c32a4a2d333b4002e9e6c/work”
},
“Name”: “overlay2”
},
“HostConfig”: {
“AutoRemove”: false,
“Binds”: [
“a46408e2f850b141441ec0936dc62dc81ff78062180c9e587b2e7ed2c778cc67:/config”,
“media:/media”
],
“BlkioDeviceReadBps”: null,
“BlkioDeviceReadIOps”: null,
“BlkioDeviceWriteBps”: null,
“BlkioDeviceWriteIOps”: null,
“BlkioWeight”: 0,
“BlkioWeightDevice”: null,
“CapAdd”: [
“AUDIT_WRITE”,
“CHOWN”,
“DAC_OVERRIDE”,
“FOWNER”,
“FSETID”,
“KILL”,
“MKNOD”,
“NET_BIND_SERVICE”,
“NET_RAW”,
“SETFCAP”,
“SETGID”,
“SETPCAP”,
“SETUID”,
“SYS_CHROOT”
],
“CapDrop”: [
“AUDIT_CONTROL”,
“BLOCK_SUSPEND”,
“DAC_READ_SEARCH”,
“IPC_LOCK”,
“IPC_OWNER”,
“LEASE”,
“LINUX_IMMUTABLE”,
“MAC_ADMIN”,
“MAC_OVERRIDE”,
“NET_ADMIN”,
“NET_BROADCAST”,
“SYSLOG”,
“SYS_ADMIN”,
“SYS_BOOT”,
“SYS_MODULE”,
“SYS_NICE”,
“SYS_PACCT”,
“SYS_PTRACE”,
“SYS_RAWIO”,
“SYS_RESOURCE”,
“SYS_TIME”,
“SYS_TTY_CONFIG”,
“WAKE_ALARM”
],
“Cgroup”: “”,
“CgroupParent”: “”,
“CgroupnsMode”: “private”,
“ConsoleSize”: [
0,
0
],
“ContainerIDFile”: “”,
“CpuCount”: 0,
“CpuPercent”: 0,
“CpuPeriod”: 0,
“CpuQuota”: 0,
“CpuRealtimePeriod”: 0,
“CpuRealtimeRuntime”: 0,
“CpuShares”: 0,
“CpusetCpus”: “”,
“CpusetMems”: “”,
“DeviceCgroupRules”: null,
“DeviceRequests”: ,
“Devices”: ,
“Dns”: ,
“DnsOptions”: ,
“DnsSearch”: ,
“ExtraHosts”: ,
“GroupAdd”: null,
“IOMaximumBandwidth”: 0,
“IOMaximumIOps”: 0,
“Init”: false,
“IpcMode”: “private”,
“Isolation”: “”,
“Links”: null,
“LogConfig”: {
“Config”: {},
“Type”: “json-file”
},
“MaskedPaths”: [
“/proc/asound”,
“/proc/acpi”,
“/proc/kcore”,
“/proc/keys”,
“/proc/latency_stats”,
“/proc/timer_list”,
“/proc/timer_stats”,
“/proc/sched_debug”,
“/proc/scsi”,
“/sys/firmware”
],
“Memory”: 0,
“MemoryReservation”: 0,
“MemorySwap”: 0,
“MemorySwappiness”: null,
“NanoCpus”: 0,
“NetworkMode”: “host”,
“OomKillDisable”: null,
“OomScoreAdj”: 0,
“PidMode”: “”,
“PidsLimit”: null,
“PortBindings”: {
“32400/tcp”: [
{
“HostIp”: “”,
“HostPort”: “32400”
}
]
},
“Privileged”: false,
“PublishAllPorts”: false,
“ReadonlyPaths”: [
“/proc/bus”,
“/proc/fs”,
“/proc/irq”,
“/proc/sys”,
“/proc/sysrq-trigger”
],
“ReadonlyRootfs”: false,
“RestartPolicy”: {
“MaximumRetryCount”: 0,
“Name”: “always”
},
“Runtime”: “runc”,
“SecurityOpt”: null,
“ShmSize”: 67108864,
“UTSMode”: “”,
“Ulimits”: null,
“UsernsMode”: “”,
“VolumeDriver”: “”,
“VolumesFrom”: null
},
“HostnamePath”: “/var/lib/docker/containers/b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf/hostname”,
“HostsPath”: “/var/lib/docker/containers/b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf/hosts”,
“Id”: “b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf”,
“Image”: “sha256:adb476b21424ab8e210aee41b058d964cd7241a9759df78f29caddb68a73f1f9”,
“LogPath”: “/var/lib/docker/containers/b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf/b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf-json.log”,
“MountLabel”: “”,
“Mounts”: [
{
“Destination”: “/config”,
“Driver”: “local”,
“Mode”: “z”,
“Name”: “a46408e2f850b141441ec0936dc62dc81ff78062180c9e587b2e7ed2c778cc67”,
“Propagation”: “”,
“RW”: true,
“Source”: “/var/lib/docker/volumes/a46408e2f850b141441ec0936dc62dc81ff78062180c9e587b2e7ed2c778cc67/_data”,
“Type”: “volume”
},
{
“Destination”: “/media”,
“Driver”: “local”,
“Mode”: “z”,
“Name”: “media”,
“Propagation”: “”,
“RW”: true,
“Source”: “/var/lib/docker/volumes/media/_data”,
“Type”: “volume”
}
],
“Name”: “/Plex”,
“NetworkSettings”: {
“Bridge”: “”,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“HairpinMode”: false,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“MacAddress”: “”,
“Networks”: {
“host”: {
“Aliases”: null,
“DriverOpts”: null,
“EndpointID”: “45e6f84bed28a4188bd67fffcfcc137a35158dbe0c90b7e81a486999ab810bce”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAMConfig”: {},
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“Links”: null,
“MacAddress”: “”,
“NetworkID”: “488d4a5f7f11a90501412563a57c2998694aead3e874bdf7b34e9ea4fb7557a1”
}
},
“Ports”: {},
“SandboxID”: “02a5bf83edae63f7275a0ed2bf1a11e7a70cbcf635e0b1e69c697aaf97743e1b”,
“SandboxKey”: “/var/run/docker/netns/default”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null
},
“Path”: “/init”,
“Platform”: “linux”,
“Portainer”: {
“ResourceControl”: {
“Id”: 30,
“ResourceId”: “b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf”,
“SubResourceIds”: ,
“Type”: 1,
“UserAccesses”: ,
“TeamAccesses”: ,
“Public”: true,
“AdministratorsOnly”: false,
“System”: false
}
},
“ProcessLabel”: “”,
“ResolvConfPath”: “/var/lib/docker/containers/b8cd7673a796e44d8a2ce3053fe553676a5cfe3d852b990182487e68b26dfbaf/resolv.conf”,
“RestartCount”: 0,
“State”: {
“Dead”: false,
“Error”: “”,
“ExitCode”: 0,
“FinishedAt”: “2023-03-21T18:22:44.957226384Z”,
“OOMKilled”: false,
“Paused”: false,
“Pid”: 869,
“Restarting”: false,
“Running”: true,
“StartedAt”: “2023-03-21T18:24:43.18608854Z”,
“Status”: “running”
}
}

linuxserver.io provides a yml file on the docker hub. All you have to do with it is paste it into a Portainer stack, edit for your use case, and deploy it. Post what you deployed when asked.

https://hub.docker.com/r/linuxserver/plex

thanks I gave that a quick try. having some small issues with volumes under stacks and mapping but I can figure that out on my own.
Thanks again.

Why are you using linuxserver docker image when Plex has their own? Here’s a sample config I use for bridge networking.

podman run \
-d \
--name plexserver \
--net plexnet \
--device=/dev/dvb \
-p 10.0.0.26:32400:32400/tcp \
-e TZ="America/New_York" \
-e ADVERTISE_IP="https://10.0.0.26:32400,https://your.public.ip:32400" \
-e PLEX_UID=1001 \
-e PLEX_GID=1001 \
-h plex.home.lab \
-v /storage/plex/plexmediaserver:/config:z \
-v /storage/sr1/files:/storage/sr1/files \
-v /storage/sr2/files:/storage/sr2/files \
plexinc/pms-docker:beta

In this setup you disable remote access and then port forward manually at your router. Flawless.

To answer your question as to why I chose the linuxserver docker image over plex docker image. I like the linuxserver Framework and consistency across all their images.

1 Like

This the docker compose that I finial got working.

note that I used previously manually defined “PlexConfig” Volume.

I tried using the previously manually defined cifs volumes I had but those resulted in passed in host unresolved type errors for the media and jobd shares. if someone has a different solution for these volumes/,mounts please do share.

jobd is used for tv shows that I delete after watching

version: "2.1"

services:
plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex01
    network_mode: host
    environment:
      - PUID=0
      - PGID=0
      - TZ=America/Toronto
      - VERSION=docker
    volumes:
      - PlexConfig:/config
      - media:/media
      - jobd:/jobd
    restart: unless-stopped

volumes:
      PlexConfig:
        name: PlexConfig
        external: true
      media:
        driver: local
        driver_opts:
          type: cifs
          device: //192.168.0.135/media
          o: "username=user,password=password,vers=3.0"
      jobd:
        driver: local
        driver_opts:
          type: cifs
          device: //192.168.0.135/jobd
          o: "username=user,password=password,vers=3.0"

Running with PUID=0 and PGID=0 is a terrible idea.

Mapping the Plex /config to a remote share can be problematic because there is no file locking support.

thanks

Yes I understand the risk of PUID/PGID 0

as for the /config that is not a CIFS/SMB share but in fact a local portainer volume but needs to be defined as external because it already exists and I don’t want / need it to be created

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.