Skip to content

Instantly share code, notes, and snippets.

@byk0t
Last active January 26, 2024 16:08
Show Gist options
  • Save byk0t/a9644fd2360a9662702568459df289fc to your computer and use it in GitHub Desktop.
Save byk0t/a9644fd2360a9662702568459df289fc to your computer and use it in GitHub Desktop.
Docker compose for odoo:14 and PostgreSQL:13
version: '3'
services:
db:
image: postgres:13
volumes:
- db-data:/var/lib/postgresql/data/pgdata
ports:
- 5432:5432/tcp
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- POSTGRES_DB=postgres
- PGDATA=/var/lib/postgresql/data/pgdata
web:
image: odoo:14.0
depends_on:
- db
ports:
- "8069:8069/tcp"
volumes:
- web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
volumes:
db-data:
driver: local
web-data:
driver: local
@frdriss
Copy link

frdriss commented Sep 14, 2019

Hi Pavel,
I have to rename "db" service. when I do it and change de "depends_on" in "web" container to the same new "bd" service name the container failds! it can find "db"! I think it's hard coded some where. this is the error message that I found in docker-compose logs:
psycopg2.OperationalError: could not translate host name "db" to address: Name or service not known
Thanks for your good job!

@byk0t
Copy link
Author

byk0t commented Nov 11, 2020

The gist is updated with odoo:14 and postgresql:13 versions.

@byk0t
Copy link
Author

byk0t commented Nov 14, 2020

I use these containers the next way:

  1. Create addons and config folders
  2. Run sudo chmod -R 777 addons (We need it writable from inside the docker container, for example for an odoo_bin utility)
  3. Run docker-compose up -d
  4. Generate a module docker exec -d odoo-test_web_1 /usr/bin/odoo scaffold openacademy /mnt/extra-addons && sudo chown -R pavel:pavel addons/openacademy (pavel is a my user . If we don't change an owner we will not be able to edit a source code outside the container)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment