tuxgasy/docker-dolibarr

Access MariaDB on host

Closed this issue · 3 comments

Hello,

I'm tryng setting the dolibarr container access on my host machine mariadb.

I tried the following :

docker run -d --name dolibarr -e DOLI_DB_HOST="host.docker.internal" -e DOLI_DB_USER="root" -e DOLI_DB_PASSWORD="PASS" -e DOLI_DB_NAME="dolibarr" -e DOLI_URL_ROOT="http://MYIP" -e PHP_INI_DATE_TIMEZONE='Europe/Paris' -p 8082:80 tuxgasy/dolibarr
docker run -d --name dolibarr -e DOLI_DB_HOST="172.17.0.1:3306" -e DOLI_DB_USER="root" -e DOLI_DB_PASSWORD="PASS" -e DOLI_DB_NAME="dolibarr" -e DOLI_URL_ROOT="http://MYIP" -e PHP_INI_DATE_TIMEZONE='Europe/Paris' -p 8082:80 tuxgasy/dolibarr
docker run -d --name dolibarr --net=host -e DOLI_DB_HOST="localhost" -e DOLI_DB_USER="root" -e DOLI_DB_PASSWORD="PASS" -e DOLI_DB_NAME="dolibarr" -e DOLI_URL_ROOT="http://MYIP" -e PHP_INI_DATE_TIMEZONE='Europe/Paris' -p 8082:80 tuxgasy/dolibarr

Result :

eab8561987b1        tuxgasy/dolibarr           "docker-run.sh"     4 minutes ago       Up 4 minutes        0.0.0.0:8082->80/tcp                                                         dolibarr

I once got the following error :

Waiting that SQL database is up...

and

usermod: no changes

These are not errors.

As long as the connection with the MySQL server cannot be established, you have the message Waiting that SQL database is up...

The message usermod: no changes appears when you do not change env WWW_USER_ID and WWW_GROUP_ID. Ignore it.

Thanks for the reply. Well it's working successfuly when I'm using docker compose from the README. I'm trying to access the database server from google cloud (https://cloud.google.com/sql/docs/mysql?hl=fr). Here is how I run the container :

 docker run -d --name dolibarr -e DOLI_DB_HOST="HOSTDBIP" -e DOLI_DB_USER="USER" -e DOLI_DB_PASSWORD="PASS" -e DOLI_DB_NAME="dolibarr" -e DOLI_URL_ROOT="http://IP" -e PHP_INI_DATE_TIMEZONE='Europe/Paris' -p 80:80 tuxgasy/dolibarr

Do I need to create the database before creating the container ?
I have no error doing docker logs dolibarr

Depending on your networking rules, sometimes docker is not accessing the internet.
Basically you can run docker with command /bin/bash in order to test that container is accessing the mysql database.

This image will create tables in the given database, so yes you'll have to create at least user and empty database.