Re: pgadmin4 container install: volume mapping - Mailing list pgadmin-support

From Bo Guo
Subject Re: pgadmin4 container install: volume mapping
Date
Msg-id 161ed5b8-43aa-ceb8-1339-0c0c4dc502ce@gisticinc.com
Whole thread Raw
In response to Re: pgadmin4 container install: volume mapping  (Dave Page <dpage@pgadmin.org>)
Responses Re: pgadmin4 container install: volume mapping  (Dave Page <dpage@pgadmin.org>)
List pgadmin-support

Hi Dave, Thanks for responding to the post!

Ubuntu uses Apparmor.  With my limited knowledge on Linux, I could not find see any policy restrictions. 

I did try to volume-map to /pgadmin_session and even /tmp/pgadmin_session. However, connection settings, and the saved scripts were not showing up in the host folders.  I also tried a clean install on a different VM ubuntu 18.04 server with the latest Docker version 19.03.9 to no avail.

I ran into this article on Bind Mounts vs Volumes.  Please let me know if I should try mount instead?  https://4sysops.com/archives/introduction-to-docker-bind-mounts-and-volumes/

Thanks!

Bo


On 5/18/20 2:15 AM, Dave Page wrote:
Hi

On Sun, May 17, 2020 at 11:00 PM Bo Guo <bo.guo@gisticinc.com> wrote:

Hi list,

I have been using the docker container install of pgAdmin4 for about a year and half, during which time I tried several times trying to make volume mapping work, to no avail.

Yes, the docker installation is very clean and simple.  But I just could not make volume mapping to work so that script files saved can be accessed easily, and server connections or any session related history etc. can be preserved when updating to use latest container images.  I hope someone can provide a pointer or two to help me.

Here is what I used to create the instance

docker run --name "pgadmin4.21" \ 
-p 5050:80 \ 
-e 'PGADMIN_DEFAULT_EMAIL=pgadmin@example.com' \ 
-e 'PGADMIN_DEFAULT_PASSWORD=123456' \ 
-d dpage/pgadmin4 \ 
-v /opt/pgadmin_session:/var/lib/pgadmin \ 
-v /opt/pgadmin_config:/pgadmin4 

Docker Inspection shows the container having

            "Env": [
                "PGADMIN_DEFAULT_EMAIL=pgadmin@example.com",
                "PGADMIN_DEFAULT_PASSWORD=123456",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D",
                "PYTHON_VERSION=3.7.7",
                "PYTHON_PIP_VERSION=20.0.2",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py",
                "PYTHON_GET_PIP_SHA256=421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e",
                "PYTHONPATH=/pgadmin4"
            ],
            "Cmd": [
                "-v",
                "/opt/pgadmin_session:/var/lib/pgadmin",
                "-v",
                "/opt/pgadmin_config:/pgadmin4"
            ],

Before I start the container instance, I made sure the folders were accessible

sudo mkdir /opt/pgadmin_session 
sudo mkdir /opt/pgadmin_config 
sudo chown 5050:5050  /opt/pgadmin_session 
sudo chown 5050:5050  /opt/pgadmin_config 
sudo chmod -R 777 /opt/pgadmin_session 
sudo chmod -R 777 /opt/pgadmin_config
Technically you shouldn't need the chmods (and I would probably remove them as they give read/write permission to anyone with access to your machine). A couple of thoughts:

- Is Docker configured to allow mapping directories in /opt? On my mac, that directory isn't allowed by default.

Screenshot 2020-05-18 at 10.15.12.png

- If you're on a Linux box, is selinux enabled and possibly blocking access to those directories?
 
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
-- 
Regards,

Bo Guo, PhD, PE
President
Gistic Research, Inc.
2033 E Warner Rd Ste 105
Tempe, AZ 85284
www.gisticinc.com
www.youtube.com/linearbench
Office: 480-656-9962
Cell: 602-570-4697
Attachment

pgadmin-support by date:

Previous
From: Murtuza Zabuawala
Date:
Subject: Re: Length of SQL show in dashboard limited to 1K
Next
From: Dave Page
Date:
Subject: Re: pgadmin4 container install: volume mapping