Failing to create pmm-server on docker

I’m trying to install percona 3.1 from scratch, I’ve created the watchtower as instructed here: Install PMM Server with Docker container - Percona Monitoring and Management

But I’m having issues following these instructions running docker with volume: Run Docker with volume - Percona Monitoring and Management

I’ve simply created the volume as instructed:

docker volume create pmm-data

Then tried to create the pmm-server container:

docker run --detach --restart always --publish 443:8443 --env PMM_WATCHTOWER_HOST=watchtower --env PMM_WATCHTOWER_TOKEN=XXX --volume pmm-data:/srv --network=pmm-network --name pmm-server percona/pmm-server:3.1

But when i try to create my pmm-server container, I get this error:

FATAL: /srv is not writable for pmm user.
Please make sure that /srv is owned by uid 1000 and gid 1000 and try again.
You can change ownership by running: sudo chown -R 1000:1000 /srv

I feel like I’ve somehow missed a step or there’s missing instruction in the documentation?

I am not sure how the volume ended up having different permissions than expected if it’s brand new. Anyhow, you can modify the perms by using a temporary container for example:

docker run --rm -it -v pmm-data:/srv alpine sh
chown -R 1000:1000 /srv
exit

then retry creating pmm container

I did that but i still get the same error:

 docker run --rm -it -v pmm-data:/srv alpine sh
 # ls -l /

Gives me this

drwxr-xr-x    2 root     root          4096 Sep  6  2024 sbin
drwxr-xr-x    2 root     root          4096 Sep  6  2024 srv
dr-xr-xr-x   13 root     root             0 Dec  5 10:56 sys

So I then ran the command you gave:

chown -R 1000:1000 /srv

Now it outputs this when I do ls -l:

drwxr-xr-x    2 root     root          4096 Sep  6  2024 sbin
drwxr-xr-x   11 1000     1000          4096 May 15 12:37 srv
dr-xr-xr-x   13 root     root             0 Dec  5 10:56 sys

But when I create the container:

docker run --detach --restart always --publish 443:8443 --env PMM_WATCHTOWER_HOST=watchtower --env PMM_WATCHTOWER_TOKEN=XXX --volume pmm-data:/srv --network=pmm-network --name pmm-server percona/pmm-server:3.1

Same error:

FATAL: /srv is not writable for pmm user.
Please make sure that /srv is owned by uid 1000 and gid 1000 and try again.
You can change ownership by running: sudo chown -R 1000:1000 /srv

It looks like for some reason it isn’t looking at the docker volume I’ve created?

just in case try also creating one file inside /srv and set its owner to 1000, then check if the permissions are still there on the volume after creating the pmm container. If the dir is empty the perm might get reset

I’ve done that but the file is there and permission still set to 1000:

/ # ls -l /srv/
total 40
drwxr-xr-x    3 1000     1000          4096 May 15 12:37 alerting
drwxrwxr-x    2 1000     1000          4096 Mar 26 14:40 backup
drwxr-xr-x    2 1000     1000          4096 Mar 26 14:41 clickhouse
drwxr-xr-x    6 1000     1000          4096 May 15 12:37 grafana
drwxrwxr-x    2 1000     1000          4096 Mar 26 14:41 logs
drwxr-xr-x    2 1000     1000          4096 May 15 12:37 nginx
-rw-r--r--    1 1000     1000             6 Mar 26 14:41 pmm-distribution
drwx------   19 1000     1000          4096 May 15 12:37 postgres14
drwxr-xr-x    3 1000     1000          4096 May 15 12:37 prometheus
-rw-r--r--    1 1000     1000             0 May 15 12:54 tmp.txt
drwxrwxr-x    2 1000     1000          4096 Mar 26 14:41 victoriametrics

Is it possible that the volume is a leftover from a previous PMM v2 installation?

Can you try to transfer ownership to pmm user instead of just the UID? Something like

chown -R pmm:pmm /srv

from the docker container

No shouldn’t be be a leftover container, I literally scrapped the volume when I did it again

docker volume rm pmm-data

I get a unknown user/group when I try to transfer ownership to pmm user specifically.

Not sure what’s going on, I can see the original owner belongs to root, when I initialise the pmm-server container. I can see files getting written to the /srv folder and the permissions changing to 1000. But I get that error still?

Ok nevermind I ended up just doing a clean uninstall of docker and removing all docker files in my file system (I was only using docker for percona on this server). Re-installed docker, and followed instructions again and it worked fine. Must of had some old data that somehow screwed up the installation.

glad to hear the issue is sorted out