Skip to main content
Free Tool

Odoo Docker ComposeGenerator

Generate a production-ready docker-compose.yml for Odoo in seconds. Choose a template, customize your stack, and download.

Dev, Prod & HA Templates
Traefik & Nginx SSL
PostgreSQL Configured
Copy & Download

What is Docker Compose for Odoo?

Docker Compose lets you define your entire Odoo stack — app server, database, reverse proxy, and tools — in a single YAML file. One command (docker compose up -d) spins up everything. This generator creates that file for you with production best practices built in.

Setup TypeServicesWorkersReverse ProxySSL
DevelopmentOdoo + PostgreSQL + pgAdmin0 (single-process)NoneNo
ProductionOdoo + PostgreSQL + Traefik2-4TraefikLet's Encrypt
High AvailabilityOdoo + PostgreSQL + Traefik4+TraefikLet's Encrypt

Select a template below and customize to match your requirements. The generated file follows Odoo Docker deployment best practices.

Choose Template

Odoo Configuration

Edition

0 = single-process mode (dev only)

Mount a local addons directory

PostgreSQL Database

Password Strategy

Generated password (save this!):

uyMs7xETrPGO9KUHAT6jhJka

Reverse Proxy & SSL

Reverse Proxy

Auto-provision HTTPS certificates

Advanced Options

105 lines
Remember to change the domain from "odoo.example.com" to your actual domain before deploying.
A random database password has been generated in the .env file. Save it securely — you will need it for backups and direct DB access.
# Generated by OEC.sh Docker Compose Generator
# https://oec.sh/tools/docker-compose-generator
# Template: production | Odoo 19.0 community
#
# Secrets are in the .env file (auto-read by Docker Compose).
# NEVER commit the .env file to version control.
#
# Usage:
#   docker compose up -d
#   docker compose logs -f odoo
#

services:
  odoo:
    image: "odoo:19.0"
    container_name: odoo
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    environment:
      HOST: db
      PORT: "5432"
      USER: "${POSTGRES_USER}"
      PASSWORD: "${POSTGRES_PASSWORD}"
    volumes:
      - "odoo-data:/var/lib/odoo"
    networks:
      - odoo-net
    ports: []
    command: "--workers=2 --max-cron-threads=1 --gevent-port=8072 --proxy-mode --database=odoo --admin-passwd=${ODOO_ADMIN_PASSWORD}"
    labels:
      - traefik.enable=true
      - "traefik.http.routers.odoo.rule=Host(`odoo.example.com`)"
      - traefik.http.services.odoo.loadbalancer.server.port=8069
      - traefik.http.routers.odoo.entrypoints=websecure
      - traefik.http.routers.odoo.tls.certresolver=letsencrypt
      - "traefik.http.routers.odoo-longpolling.rule=Host(`odoo.example.com`) && PathPrefix(`/longpolling`)"
      - traefik.http.routers.odoo-longpolling.service=odoo-longpolling
      - traefik.http.services.odoo-longpolling.loadbalancer.server.port=8072
      - traefik.http.routers.odoo-longpolling.entrypoints=websecure
      - traefik.http.routers.odoo-longpolling.tls.certresolver=letsencrypt
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"
    healthcheck:
      test: "[\"CMD\", \"curl\", \"-f\", \"http://localhost:8069/web/health\"]"
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    deploy:
      resources:
        limits:
          cpus: "1"
          memory: 2048M
  db:
    image: "postgres:16-alpine"
    container_name: db
    restart: unless-stopped
    environment:
      POSTGRES_DB: "${POSTGRES_DB}"
      POSTGRES_USER: "${POSTGRES_USER}"
      POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
      POSTGRES_HOST_AUTH_METHOD: scram-sha-256
      POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
    volumes:
      - "postgres-data:/var/lib/postgresql/data"
    networks:
      - odoo-net
    healthcheck:
      test: "[\"CMD-SHELL\", \"pg_isready -U $POSTGRES_USER -d $POSTGRES_DB\"]"
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"
  traefik:
    image: "traefik:v3.2"
    container_name: traefik
    restart: unless-stopped
    ports:
      - "\"80:80\""
      - "\"443:443\""
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "traefik-certs:/letsencrypt"
    networks:
      - odoo-net
    command: "--providers.docker=true --providers.docker.exposedbydefault=false --entrypoints.web.address=:80 --entrypoints.websecure.address=:443 --entrypoints.web.http.redirections.entrypoint.to=websecure --certificatesresolvers.letsencrypt.acme.email=admin@example.com --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"

volumes:
  odoo-data: null
  postgres-data: null
  traefik-certs: null

networks:
  odoo-net:
    driver: bridge

How It Works

Step 1

Choose a Template

Start with Development, Production, or High Availability. Each template pre-configures sensible defaults for its use case.

Step 2

Customize Your Stack

Configure Odoo version, PostgreSQL, reverse proxy, SSL, workers, and advanced options. See the YAML update in real time.

Step 3

Copy & Deploy

Copy the YAML to clipboard, download as a file, or share a URL. Then run docker compose up -d on your server.

Frequently Asked Questions

Common questions about running Odoo with Docker Compose.

What is the best Docker Compose setup for Odoo?
The best Docker Compose setup for Odoo production includes: Odoo with multi-worker mode (2+ workers), PostgreSQL with scram-sha-256 authentication, Traefik or Nginx as a reverse proxy with SSL, persistent volumes for data and addons, health checks, and restart policies. Use our generator above to create a production-ready configuration in seconds.
How many workers should I configure for Odoo in Docker?
Configure 2 workers per 10 concurrent users. For development, use workers=0 (single-process mode). For production, start with 2-4 workers. Each worker uses ~150-200MB RAM, so ensure your container has enough memory. The formula is: workers = (2 * CPU cores) + 1, with 1-2 cron threads. Never exceed 2 workers per CPU core.
Should I use Traefik or Nginx as a reverse proxy for Odoo?
Traefik is recommended for Docker-native deployments — it auto-discovers containers, handles SSL certificates via Let's Encrypt automatically, and requires minimal configuration. Nginx is better if you already have Nginx expertise or need fine-grained control over caching and request handling. Both work well with Odoo; Traefik is simpler to set up with Docker Compose.
How do I enable SSL/HTTPS for Odoo with Docker?
Use a reverse proxy (Traefik or Nginx) to terminate SSL. With Traefik: add certresolver configuration pointing to Let's Encrypt, set entrypoints for ports 80 and 443, and add labels to your Odoo service. With Nginx: mount your SSL certificates and configure the server block. Our generator creates the complete configuration for both options automatically.
What PostgreSQL version works best with Odoo 19?
PostgreSQL 16 is recommended for Odoo 19. It offers the best performance with improved query planning, parallel query execution, and logical replication. PostgreSQL 15 and 14 also work well. Always use the Alpine variant (postgres:16-alpine) in Docker for a smaller image size. Enable scram-sha-256 authentication for security.
How do I add custom Odoo modules in Docker?
Mount a local directory as a volume to /mnt/extra-addons in the Odoo container. Add --addons-path=/mnt/extra-addons,/usr/lib/python3/dist-packages/odoo/addons to the Odoo command. In docker-compose.yml, add a volume like "./addons:/mnt/extra-addons". Place your custom modules in the addons directory and restart the container.
What are the minimum system requirements for Odoo in Docker?
Minimum requirements for Odoo in Docker: 2GB RAM (4GB recommended for production), 2 vCPU cores, 20GB SSD storage. PostgreSQL needs at least 256MB RAM. For production with workers, plan 150-200MB RAM per worker plus 2GB base. The Docker host should run a 64-bit Linux with kernel 4.0+ and Docker Engine 20.10+.
How do I backup my Odoo Docker deployment?
Backup both the Odoo filestore and PostgreSQL database. For the database: docker exec db pg_dump -U odoo odoo > backup.sql. For the filestore: docker cp odoo:/var/lib/odoo/filestore ./backup-filestore. Automate with cron jobs. For production, use pg_basebackup for point-in-time recovery. Store backups off-server (S3, B2, or another cloud storage).

Ready to Deploy Your Odoo?

OEC.sh automates Odoo deployment on any cloud provider. Use the generated Docker Compose file with our platform for one-click deployments, monitoring, and backups.