Docker installation - unable to create first user

Checklist
[ X] I have read intro post: About the Installation Issues category
[ X] I have read the tutorials, help and searched for similar issues

[ X] I provide relevant information about my server

  • Docker server
  • RH8
  • MySql database hosted on separated server

I describe the steps I have taken to trouble shoot the problem
I describe the steps on how to reproduce the issue

Hi everyone.

I am trying to install PassBolt in docker.

this is the compose file I’m using:

version: "3.9"
services:
  passbolt:
    container_name: passbolt
    image: passbolt/passbolt:latest-ce
    #Alternatively you can use rootless:
    #image: passbolt/passbolt:latest-ce-non-root
    restart: unless-stopped
    environment:
      APP_FULL_BASE_URL: https://192.168.1.20:10443/
      #DATASOURCES_DEFAULT_URL: "SERVERNAME"
      DATASOURCES_DEFAULT_HOST: "SERVERNAME"
      DATASOURCES_DEFAULT_USERNAME: "passbolt"
      DATASOURCES_DEFAULT_PASSWORD: "THEPASSWORD"
      DATASOURCES_DEFAULT_DATABASE: "passbolt"
    volumes:
      - /var/lib/docker/volumes/passbolt_volume/_data/gpg:/etc/passbolt/gpg
      - /var/lib/docker/volumes/passbolt_volume/_data/jwt:/etc/passbolt/jwt
    command:
      [
        "/usr/bin/wait-for.sh",
        "-t",
        "0",
        "SERVERNAME:3306",
        "--",
        "/docker-entrypoint.sh",
      ]
    ports:
      - 1080:80
      - 10443:443

I previously created the MYSQL user and an EMPTY DATABASE.

WHEN the container starts, it completes the DB creation and migration process, and the webpage for the login appears.
So, I suppose the DB connection is actually working.

I’m following the guide, and executing the command:

docker exec -it passbolt sh                            <-- to access the shell
su -l www-data -s /bin/bash                          <-- switch linux user
/usr/share/php/passbolt/bin/cake passbolt register_user -u xxx@xxxx.it -f xxxxx -l xxxxx -r admin

but this error appears:


2024-05-28 16:09:37 error: [Cake\Database\Exception\MissingConnectionException] Connection to Mysql could not be established: SQLSTATE[HY000] [2002] No such file or directory in /usr/share/php/passbolt/vendor/cakephp/cake                                                     php/src/Database/Driver.php on line 144
Caused by: [PDOException] SQLSTATE[HY000] [2002] No such file or directory in /usr/share/php/passbolt/vendor/cakephp/cakephp/src/Database/Driver.php on line 132

healthcheck:

`
www-data@087177e79445:~$ /usr/share/php/passbolt/bin/cake passbolt healthcheck
warning: 512 :: SplFileInfo::openFile(/var/lib/passbolt/tmp/cache/persistent/myapp_cake_core_translations.cake_console.en_UK): Failed to open stream: Permission denied on line 393 of /usr/share/php/passbolt/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php
warning: 512 :: SplFileInfo::openFile(/var/lib/passbolt/tmp/cache/persistent/myapp_cake_core_translations.cake_console.en_UK): Failed to open stream: Permission denied on line 393 of /usr/share/php/passbolt/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php

     ____                  __          ____
    / __ \____  _____ ____/ /_  ____  / / /_
   / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/
  / ____/ /_/ (__  |__  ) /_/ / /_/ / / /
 /_/    \__,_/____/____/_.___/\____/_/\__/

 Open source password manager for teams
-------------------------------------------------------------------------------
 Healthcheck shell.........................................2024-05-28 16:26:20 error: [TypeError] strpos(): Argument #1 ($haystack) must be of type string, bool given in /usr/share/php/passbolt/src/Service/Healthcheck/Application/SslFullBaseUrlApplicationHealthcheck.php on line 39
`

Hello @andreaci and welcome to the forum!
Have you tried using source /etc/environment before?
As you are giving the credentials as environment variables, you have to set it on your terminal environment to be able to use it

Ok, I found the “solution”.

I had to connect to the container’s shell directly using www-data.
using su won’t set all the variables.

yes, you can also do something like

docker compose exec passbolt su -m -c "./bin/cake passbolt register_user -u admin@passbolt.com -f FIRSTNAME -l LASTNAME -r admin" -s /bin/bash www-data