I tried to create a Docker container for my Odoo application. I wanted to have a customized password so I used this docker compose sample from Hub Docker for Odoo but changing the version to Odoo 18 and Postgres 17
services:
web:
image: odoo:18.0
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
environment:
- PASSWORD_FILE=/run/secrets/postgresql_password
secrets:
- postgresql_password
db:
image: postgres:17
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
secrets:
- postgresql_password
volumes:
odoo-web-data:
odoo-db-data:
secrets:
postgresql_password:
file: odoo_pg_pass
I also have a odoo.conf:
[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
Few months ago, I did this with my laptop (but still using Postgres 16) and it worked. I am trying to do this with my desktop computer (using Postgres 17) but it did not worked, having an issue in the Odoo Database creation screen with a "Database creation error: Access Denied", as I put in the Master Password the password found in odoo_pg_pass. I tried to use the exact configuration as in my laptop (using Postgres 16) but still it did not worked, though it is actually still working in my laptop. My laptop and desktop are both Windows and have an updated Docker Desktop.
The difference I noticed between the laptop and desktop during the Odoo creation screen is that in the laptop, the Master Password is generated randomly and shown.
But in my desktop, it is not shown, and it did not recognized the password in the odoo_pg_pass. Also in the laptop, after successful db creation, there will be an admin_password
line in odoo.conf
So I guess, I need the master password to be initially generated? How could I do that? Again there was no difference in the code but in my desktop it did not show.
I solved my issue though I do not know the technical reason. I have an existing Postgres (and Odoo) installation in my desktop. I was searching in the official Odoo forums and found a comment in the Database Creation issue here. The poster of the question/issue is creating a new database in his server. One commenter said that he had the same issue with Windows and it is because Postgres is installed first before Odoo and suggested uninstalling Postgres, delete all its related folders and uninstall Odoo. Then re-install Odoo again with the option to install Postgres.
Actually, I uninstalled Postgres a day before (still have not read the forum article) since I have a hunch. However, the same issue appeared. Then after reading the article, I check my installed programs again if I still have other Postgres versions, lo and behold, I have Odoo installed (which I forgot that I have installed last year).
My Odoo Docker installation in my desktop is now generating the initial Master Password for the initial build. I really do not know why but the Odoo and Postgres applications in my system is "interfering" with my Odoo Docker container.