Error display on my IP address : No database connection, check your database credentials in your configuration file. Checking common issues:

hi,

I use the command on my Debian 11 file server to install Leantime:

docker run -d -p 80:80 -e LEAN_DB_HOST=localhost -e LEAN_DB_USER=root -e LEAN_DB_PASSWORD=Password1 -e LEAN_DB_DATABASE=leantime --name leantime leantime/leantime:latest

when I open at browser page using my IP address

it displayed “No database connection, check your database credentials in your configuration file. Checking common issues:”

I have checked my MariaDB Leantime database is having Host : localhost, user: root has full access, password is “Password1”

Not sure what is wrong with the configuration, please help.

Thank you

Hello @raymond0517 ,
Looks like it’s not an issue with docker.

as per instruction, I can see you did not use --network flag to use a specific network same as your MySQL instance.
please make sure your MySQL instance is up and can be accessible via docker network if you are using both with docker run

To extend on @alishah730’s response:

You need to create a network with docker network create {network} then create your database container with docker run --name database --network {network} ... ,then run the leantime container with docker run --name leantime --network {network} -e LEAN_DB_HOST=database ....

Of course {network} is just a placeholder for a name you choose yourself. And the docker run commands are incomplete, they just illustrate the relevant parts.

if you don’t specify --network when creating a container, the default bridge network is used, which does not provide built-in dns-based service discovery. User defined networks support service discovery, which allows to reach another container in the same container network by its container name (or in case of a compose deployment, its service name).

If you don’t use docker compose, I strongly suggest using it!