Re: problem with docker image : servers.json file mapping

From: Mickaël SALMON <ms(at)sylob(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: "pgadmin-support(at)lists(dot)postgresql(dot)org" <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Re: problem with docker image : servers.json file mapping
Date: 2020-09-11 06:45:08
Message-ID: PR3P193MB0764A62C19749857A834245BC0270@PR3P193MB0764.EURP193.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Sorry, when mapped to /tmp/servers.json (according to the doc), same thing ...

ms-alpine:~# ls -lh /tmp/
total 4K
drwxr-xr-x 2 root root 4.0K Sep 11 08:41 servers.json

Should not I run container with root ?

________________________________
From: Dave Page <dpage(at)pgadmin(dot)org>
Sent: Thursday, September 10, 2020 12:39
To: Mickaël SALMON <ms(at)sylob(dot)com>
Cc: pgadmin-support(at)lists(dot)postgresql(dot)org <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Re: problem with docker image

On Thu, Sep 10, 2020 at 11:35 AM Mickaël SALMON <ms(at)sylob(dot)com<mailto:ms(at)sylob(dot)com>> wrote:
Same problem after changing permissions to parent directory :

$ rm -rf /root/pgadmin4/*
$ chown -R 5050:5050 /root/pgadmin4
$ chmod 777 /root/pgadmin4
$ ls -lh

drwxrwxrwx 3 5050 5050 4.0K Sep 10 12:29 pgadmin4

This is weird, servers.json is created with root permissions, should not it be 5050 ?

ms-alpine:~/pgadmin4# ls -lh
total 4K
drwxr-xr-x 2 root root 4.0K Sep 10 12:29 servers.json

Huh, I missed that earlier. According to that, servers.json is a directory. It should be a file (note the d at the front of the ACL).

Ownership doesn't really matter, as long as the file is readable by UID 5050, and all the parent directories also have read and execute permissions that allow UID 5050 to use them.

Typically, /root is not accessible to users other than root - and it should stay that way; create another directory somewhere to put the servers.json file in.

________________________________
From: Dave Page <dpage(at)pgadmin(dot)org<mailto:dpage(at)pgadmin(dot)org>>
Sent: Thursday, September 10, 2020 10:04
To: Mickaël SALMON <ms(at)sylob(dot)com<mailto:ms(at)sylob(dot)com>>
Cc: pgadmin-support(at)lists(dot)postgresql(dot)org<mailto:pgadmin-support(at)lists(dot)postgresql(dot)org> <pgadmin-support(at)lists(dot)postgresql(dot)org<mailto:pgadmin-support(at)lists(dot)postgresql(dot)org>>
Subject: Re: problem with docker image

On Thu, Sep 10, 2020 at 8:29 AM Mickaël SALMON <ms(at)sylob(dot)com<mailto:ms(at)sylob(dot)com>> wrote:
Hi community,

I have a problem mapping file servers.json with latest docker image.

Here is how I run my container :

docker run --name pgadmin4 --restart unless-stopped -p 80:80 -e 'PGADMIN_DEFAULT_EMAIL=XXX' -e 'PGADMIN_DEFAULT_PASSWORD=XXX' -v /root/pgadmin4/servers.json:/pgadmin4/servers.json -d dpage/pgadmin4

servers.json is mapped to a directory :

ms-alpine:~/pgadmin4# ls -lh
total 4K
drwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.json
Where am I wrong ?

I suspect the container (which runs under UID 5050) cannot read files in /root on your host. The file has permissions that would allow that, but does the directory it's in?

--
Dave Page
Blog: http://pgsnake.blogspot.com<https://m365.eu.vadesecure.com/safeproxy/v3?f=r2B6Bu1YMGLBdDLn_rrfc4JEqNc-K4ehFvVkGtLq2peQpRuq4NBa94SoUE0I8dmG&i=iWfSUtUUgp9WJ17CS7tL8wjysd0xfFRDBeKmYFp0GWZrTQsFh-AQ5-G81hMKbElUiH2n44otlsFOHbViFYdhDQ&k=ScUR&r=Ot1NTvlQelt3g201FHGyTeRIXIZBp4VL2XvXKeqQhfg&u=http%3A%2F%2Fpgsnake.blogspot.com>
Twitter: @pgsnake

EDB: http://www.enterprisedb.com<https://m365.eu.vadesecure.com/safeproxy/v3?f=tM7BOgOxE5go_l2SkT721kxpqMkEHjCrCpG4eYY2tCYiQO2XvUFSMVEmqL9v6Umk&i=SZctfLAZnc1JAHXQySxCnz-cKNA1e3FmJTf5D3pqRVk8laDVqkmSjvoWX2jkShYuXegzTcA_eRjU0fLjUkrvfw&k=ad0C&r=A9FlUxK-Urmf32wgygm-O3YCHQJ5KXDR6DFvoyvsstE&u=http%3A%2F%2Fwww.enterprisedb.com>

--
Dave Page
Blog: http://pgsnake.blogspot.com<https://m365.eu.vadesecure.com/safeproxy/v3?f=QaSH_qYgWTSejcmfHeFjPwzNmQ446U-8aL5M-sDBIZbsHvdAFwtOx6Gs7IWouXEJ&i=RqD8chrYMt1ziKlyKlq7JG3NCX0qSlqUZYK6aC_juOM54_y_6mFGRIE_LwoVBHeXYP3pnYIUQpXDJNtAJvAbaw&k=AQyI&r=Bjx9cQnKGdrilQpa30pb1EjwZf06tGQ2JkRoP1rj5F8&u=http%3A%2F%2Fpgsnake.blogspot.com>
Twitter: @pgsnake

EDB: http://www.enterprisedb.com<https://m365.eu.vadesecure.com/safeproxy/v3?f=lFhG-JDsFOHg8dVEeyg0GR8HwWd9KHrAe3llv-UhjR3S1nhXWIvK6bnC7g5MitYz&i=1xVvwUThJBrCkS6hKt3yfOdGU6hH8khNS6rlhICV8Sun6TvmTZJXYQ3Kjn-CWSvfZx_snXsBBF9j2G2R1j8-hA&k=AlBj&r=uXr15sNGhsh6c1AaK9L5k1UERwPs9irzw5wwr1QQ48Y&u=http%3A%2F%2Fwww.enterprisedb.com>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2020-09-11 10:46:12 Re: problem with docker image : servers.json file mapping
Previous Message Aditya Toshniwal 2020-09-11 04:36:51 Re: Regarding login or reset to PGADMIN