As a user I can run PostgreSQL in passbolt-ce-non-root container

Checklist
I have read intro post: About the Installation Issues category
I have read the tutorials, help and searched for similar issues
I provide relevant information about my server (component names and versions, etc.)
I provide a copy of my logs and healthcheck
I describe the steps I have taken to trouble shoot the problem
I describe the steps on how to reproduce the issue


Hello, I’m trying to use Passbolt (according to this article) with postgresql, however, I’m using non-root passbolt container and getting permission denied while trying to install php-pgsql.

– Server operating system name and version: Ubuntu 20.04.5
– Database server name and version: PostgreSQL 14
– Passbolt version: 3.7.1-1-ce-non-root (docker)

– What steps did you take?

[11:00:20] me@myPC:~/passbolt$ sudo docker run -it passbolt/passbolt:3.7.1-1-ce-non-root bash
www-data@96755a52849f:/usr/share/php/passbolt$ apt update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/

www-data@96755a52849f:/usr/share/php/passbolt$ apt install php-pgsql
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

www-data@96755a52849f:/usr/share/php/passbolt$ echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied
debconf: DbDriver "config": could not write /var/cache/debconf/config.dat-new: Permission denied
www-data@96755a52849f:/usr/share/php/passbolt$ 

– What happened?
Getting permission denied, since im using non-root container. Passbolt container failed and is not running.
– What did you expect instead?
I expected to install the package


Possible fix?

Install php-pgsql with all other requirements in Dockerfile (presumably before setting USER directive) and distribute the Dockerfile in same fashion – therefore, we will have PSQL driver ready to use in every new image.

Hi @martingregorik ,

Yes, the passbolt docker-image could contain the php-pgsql package to be able to connect to postgresql backend.

In the maintime, you can build your own passbolt image with php-pgsql included (to be added in Dockerfile.rootless):

# Clone of the passbolt_docker repository
git clone git@github.com:passbolt/passbolt_docker.git
# Go to the passbolt_docker repository
cd passbolt_docker

# Build time !

# latest-ce-non-root-multiarch
docker build --build-arg PASSBOLT_REPO_URL=https://download.passbolt.com/ce/debian --build-arg PASSBOLT_PKG=passbolt-ce-server --build-arg PASSBOLT_FLAVOUR=ce --build-arg PASSBOLT_COMPONENT=stable -t passbolt/passbolt:latest-ce-non-root -f debian/Dockerfile.rootless .

Pull requests are welcome!