This repository provides a simple setup for deploying a Dolibarr ERP/CRM instance using Docker Compose. The configuration includes two main services: a dolibarr/dolibarr:21 application container and a mariadb:11.4.7 database container.
Ensure you have the following installed on your system:
- Docker
- Docker Compose
-
Create
.envfile: Copy the providedsample.envfile to.env. This file will store your configuration secrets, and it is listed in the.gitignoreto prevent tracking in Git.cp sample.env .env
-
Review Configuration: Edit the newly created
.envfile to customize the database credentials and Dolibarr application secrets.Example values from
sample.env:DOLI_URL_ROOT=https://dolibarr.localhostDOLI_ADMIN_LOGIN=adminDOLI_ADMIN_PASSWORD=password
-
Start Services: Run the following command in the directory containing
compose.yml:docker compose up -d
The
dolibarrservice is configured to wait for themariadbservice to be healthy before attempting to start.
Configuration is managed primarily through environment variables defined in the .env file, which are then passed to the Docker containers via compose.yml. The compose.yml file also provides default values for these variables if they are not set in the .env file.
| Variable | Sample Value (from sample.env) |
Default (if not set in .env) |
Purpose |
|---|---|---|---|
MYSQL_ROOT_PASSWORD |
password |
root |
Root password for the MariaDB service. |
DOLI_DB_NAME |
dolibarr |
dolidb |
Database name for Dolibarr. |
DOLI_DB_USER |
dolibarr |
dolidbuser |
Database user for Dolibarr. |
DOLI_DB_PASSWORD |
password |
dolidbpass |
Database password for Dolibarr user. |
| Variable | Sample Value (from sample.env) |
Default (if not set in .env) |
Purpose |
|---|---|---|---|
DOLI_URL_ROOT |
https://dolibarr.localhost |
http://dolibarr.localhost |
The root URL to access Dolibarr. |
DOLI_ADMIN_LOGIN |
admin |
admin |
Default administrator login. |
DOLI_ADMIN_PASSWORD |
password |
password |
Default administrator password. |
DOLI_CRON_KEY |
some-secure-key |
cron-secure-key |
Secure key for cron jobs. |
DOLI_COMPANY_NAME |
"My Company" |
company-name |
Company name for the Dolibarr setup. |
The application will be accessible at the URL configured in DOLI_URL_ROOT. You may need to modify your host machine's /etc/hosts file to resolve the custom hostname (dolibarr.localhost) if you use the default or sample configuration.
Default Administrator Credentials (from sample.env):
- Login:
admin - Password:
password
The compose.yml file uses named Docker volumes to ensure that important data persists even if the containers are removed or re-created:
dolibarr_db_data: Maps to/var/lib/mysqlin themariadbcontainer for database files.dolibarr_documents: Maps to/var/www/documentsin thedolibarrcontainer for uploaded files and documents.dolibarr_custom: Maps to/var/www/html/customin thedolibarrcontainer for custom modules and extensions.
The .gitignore file specifies files and directories that should be excluded from Git tracking: