Bind mount external volume path instead of /srv in docker for PMM data

I would like to change the path to the bind mounted volume in PMM docker setup. e.g. /mnt/data/srv.
I went through the docker setup and restore procedures. I didn’t quite get the issue with hard requirements on the bind mounted volume name /srv on the persistent container.
PMM Server expects the data volume to be /srv. Using any other value will result in data loss when upgrading.
Can’t I just backup the old one and restore it after upgrading ? or is there anything hidden underneath that I didn’t know of ?

“inside” the running container, PMM expects /srv to contain all the data. You cannot change this. What you can do is bind-mount an external path when creating the primary PMM server container. Example:

docker -v /path/to/somewhere:/srv -p 443:443 percona/pmm-server:2


@matthewb I see. I get it now. Thank you

1 Like

@matthewb Doesn’t that means there will be duplicated data ? i.e, the pmm-data container keeping the data on /var/lib/docker/… and the path where I mount ?

1 Like

No. The core container data will be in /var/lib/docker with all your other containers and volumes but the data in /srv which you bind-mount to /path/where/ever will only be stored there.

I suggest you find some Docker 101 videos and read up on documentation of Docker as a lot of this is basic docker concepts.

1 Like

@matthewb I understand 101 and how the docker works. What I do not understand is the double indirection with the volume mapping. The data in pmm-data which is mapped like so
source: /var/lib/docker/volumes/*/_data
target: /srv

in the pmm-server again I am mapping (like you suggested) to an external volume. Now I have data on the partition where docker is installed, The same data is now being used by the pmm-server. (with --volume-from). I am mapping again to the same volume from the pmm-server to external volume i.e, /path/whatever:/srv The same data is now synced to the external volume on the /path/whatever ? .is my understanding correct here ? would you care to explain please.

1 Like

If you use a bind-mount to the pmm-server container, like I demonstrated above, then pmm-data is irrelevant as you won’t use it at all. Thus, no duplication of data anywhere.

There are 2 exclusive choices:

  1. use pmm-data container, which writes its data to your docker volumes path
  2. no pmm-data container and bind-mount path to pmm-server to pick whereever you want the data written
1 Like

@matthewb Exactly that was what I was missing. I had no clue that these two were mutually exclusive.I was thinking that it was done so that to circumvent the user account permission issues in mounted volumes. It was not mentioned in the documentation. Thank you and I really appreciate your time to explain.

1 Like