Actually, the issue was me not reading the fine print that the servers.json is only used when the volume is created, and not subsequently. I did a docker prune of all the volumes and re-ran my setup and the servers.json was in fact used.
Ah, good.
As to your comment about the Dockerfile, I am using it and it does default to putting the file in /pgadmin4.
Interesting - I guess that's because our Dockerfile has "WORKDIR /pgadmin4" in it. I didn't realise that would affect a "downstream" Dockerfile as well.
However, I am unable to see any impact from having this file. Here are the docker logs from the container:
...
Here is my Dockerfile:
FROMdpage/pgadmin4:latest
EXPOSE80
COPY--chown=pgadmin:pgadminservers.json.
Won't that copy servers.json into /, not /pgadmin4/?
In any case, this seems like an odd way to do this - any reason not to just map the file as Aditya suggested? I suppose if you're distributing the container to others it might make sense.