Обсуждение: problem with docker image
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 -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.json
Where am I wrong ?
Cheers,
On Thu, Sep 10, 2020 at 8:29 AM Mickaël SALMON <ms@sylob.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/pgadmin4servers.json is mapped to a directory :ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.jsonWhere 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?
Same problem after changing permissions to parent directory :
$ rm -rf /root/pgadmin4/*$ chown -R 5050:5050 /root/pgadmin4$ chmod 777 /root/pgadmin4$ ls -lhdrwxrwxrwx 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 -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 12:29 servers.json
From: Dave Page <dpage@pgadmin.org>
Sent: Thursday, September 10, 2020 10:04
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker image
Sent: Thursday, September 10, 2020 10:04
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker image
On Thu, Sep 10, 2020 at 8:29 AM Mickaël SALMON <ms@sylob.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/pgadmin4servers.json is mapped to a directory :ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.jsonWhere 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?
On Thu, Sep 10, 2020 at 11:35 AM Mickaël SALMON <ms@sylob.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 -lhdrwxrwxrwx 3 5050 5050 4.0K Sep 10 12:29 pgadmin4This is weird, servers.json is created with root permissions, should not it be 5050 ?
ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-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@pgadmin.org>
Sent: Thursday, September 10, 2020 10:04
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker imageOn Thu, Sep 10, 2020 at 8:29 AM Mickaël SALMON <ms@sylob.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/pgadmin4servers.json is mapped to a directory :ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.jsonWhere 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?--
Sorry, when mapped to /tmp/servers.json (according to the doc), same thing ...
ms-alpine:~# ls -lh /tmp/total 4Kdrwxr-xr-x 2 root root 4.0K Sep 11 08:41 servers.json
Should not I run container with root ?
From: Dave Page <dpage@pgadmin.org>
Sent: Thursday, September 10, 2020 12:39
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker image
Sent: Thursday, September 10, 2020 12:39
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker image
On Thu, Sep 10, 2020 at 11:35 AM Mickaël SALMON <ms@sylob.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 -lhdrwxrwxrwx 3 5050 5050 4.0K Sep 10 12:29 pgadmin4This is weird, servers.json is created with root permissions, should not it be 5050 ?
ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-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@pgadmin.org>
Sent: Thursday, September 10, 2020 10:04
To: Mickaël SALMON <ms@sylob.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: problem with docker imageOn Thu, Sep 10, 2020 at 8:29 AM Mickaël SALMON <ms@sylob.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/pgadmin4servers.json is mapped to a directory :ms-alpine:~/pgadmin4# ls -lhtotal 4Kdrwxr-xr-x 2 root root 4.0K Sep 10 09:26 servers.jsonWhere 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?--
On Fri, Sep 11, 2020 at 7:45 AM Mickaël SALMON <ms@sylob.com> wrote:
Sorry, when mapped to /tmp/servers.json (according to the doc), same thing ...ms-alpine:~# ls -lh /tmp/total 4Kdrwxr-xr-x 2 root root 4.0K Sep 11 08:41 servers.jsonShould not I run container with root ?
It shouldn't matter what user you launch the container with, as long as the file is readable by UID 5050 (which it should be, given the permissions above - though the file doesn't need execute permissions).
Is Docker configured to let you mount files in /tmp? On my mac, there are configuration options to specify what directories files can be shared from. I don't know how that's configured on other OSs.