Persist Preferences.xml on docker upgrades

Post Reply
benjaminchodroff
Posts: 2
Joined: Fri Jan 04, 2019 1:41 am

Persist Preferences.xml on docker upgrades

Post by benjaminchodroff »

I use My Media for Alexa in docker (https://www.mymediaalexa.com/home/docker) using bizmodeller/mymediaforalexa:latest.

Unfortunately, every time I pull an updated image, my Preferences.xml is overwritten and lost. (I automatically pull new images using centurylink/watchtower)

I am certain that I have mapped a directory MyMediaForAlexa to /datadir in docker. Unfortunately, it seems new images do not respect that the server is already set up and it just overwrites the existing data.

Here is my exact docker runtime information. I would appreciate any help!

Code: Select all

ash-4.3# docker inspect 11ebb3c6fbfa
[
    {
        "Id": "11ebb3c6fbfa406eb6b50e78fbfa0173995a41e6c8daaf13e3e85440f136b16d",
        "Created": "2019-02-20T08:50:32.390728579Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "/opt/mymedia/MyMediaForAlexa"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 19227,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-03-08T22:34:46.498704448Z",
            "FinishedAt": "2019-03-08T22:30:17.074133869Z",
            "StartedTs": 1552084486,
            "FinishedTs": 1552084217
        },
        "Image": "sha256:1e19ddafd74b291f5bc30ee1aca109a64ab7d925c19e559d003d3e4423e424ef",
        "ResolvConfPath": "/volume1/@docker/containers/11ebb3c6fbfa406eb6b50e78fbfa0173995a41e6c8daaf13e3e85440f136b16d/resolv.conf",
        "HostnamePath": "/volume1/@docker/containers/11ebb3c6fbfa406eb6b50e78fbfa0173995a41e6c8daaf13e3e85440f136b16d/hostname",
        "HostsPath": "/volume1/@docker/containers/11ebb3c6fbfa406eb6b50e78fbfa0173995a41e6c8daaf13e3e85440f136b16d/hosts",
        "LogPath": "/volume1/@docker/containers/11ebb3c6fbfa406eb6b50e78fbfa0173995a41e6c8daaf13e3e85440f136b16d/log.db",
        "Name": "/bizmodeller-mymediaforalexa1",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": [
            "a533d0c39bcc7c156d158903f323ec57d5005ec56b8c76590c07d97073ed4e5b"
        ],
        "HostConfig": {
            "Binds": [
                "/volume1/music:/medialibrary:rw",
                "/volume1/docker/mymediaforalexa/datadir:/datadir:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "db",
                "Config": {}
            },
            "NetworkMode": "bridge",
            "PortBindings": {
                "52050/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "52050"
                    }
                ],
                "52051/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "52051"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": [],
            "CapDrop": [],
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Env": null,
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 50,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Data": null,
            "Name": "aufs"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/volume1/docker/mymediaforalexa/datadir",
                "Destination": "/datadir",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "/volume1/music",
                "Destination": "/medialibrary",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "bizmodeller-mymediaforalexa1",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "52050/tcp": {},
                "52051/tcp": {}
            },
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "ArgsEscaped": true,
            "Image": "bizmodeller/mymediaforalexa:latest",
            "Volumes": {
                "/datadir": {},
                "/medialibrary": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "/bin/sh",
                "-c",
                "/opt/mymedia/MyMediaForAlexa"
            ],
            "OnBuild": null,
            "Labels": {},
            "DDSM": false
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "89dd30a5abd842981759e3f1ff53eb49477f8af516da413b2a4d6ff7ac1413a2",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "52050/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "52050"
                    }
                ],
                "52051/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "52051"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/89dd30a5abd8",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "9b1eb0e859feb128d52dd9e89195a1ae9df0c2cb14d9733ac31f1c9e5b742154",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.5",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:05",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "a5e352affc4fa7a62873053d637b030b8594bbd12e54249f65abe5458973c48a",
                    "EndpointID": "9b1eb0e859feb128d52dd9e89195a1ae9df0c2cb14d9733ac31f1c9e5b742154",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.5",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:05"
                }
            }
        }
    }
]
bizmodeller
Posts: 458
Joined: Thu Nov 14, 2013 8:40 pm

Re: Persist Preferences.xml on docker upgrades

Post by bizmodeller »

Sorry missed this one (and realize it's over a year), however, for other users who come across it:

We provide a volume mapping for /datadir which is used to store both preferences, watch folder metadata and the library database. This should be mapped to a volume outside the container if you are using Docker. So in your config:

"Volumes": {
"/datadir": {},
"/medialibrary": {}
},

is the problem - map /datadir to a real directory and everything will be persisted across image updates.
Post Reply