Deploy Odoo with Docker
Production-ready Docker Compose setup for Odoo with PostgreSQL, persistent storage, environment configuration, and optional Nginx SSL reverse proxy.
Why it matters
Automate Odoo deployments using a production-ready Docker setup. This skill generates essential configuration files and provides debugging assistance for Odoo and PostgreSQL within a Dockerized environment.
Outcomes
What it gets done
Generate docker-compose.yml and odoo.conf for Odoo deployments
Configure PostgreSQL and Odoo services for Docker
Provide debugging for container startup and database connection issues
Integrate optional Nginx reverse proxy with SSL
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-odoo-docker-deployment | bash Overview
Odoo Docker Deployment
Complete Docker deployment configuration for Odoo with PostgreSQL database, persistent storage, and optional SSL reverse proxy Setting up Odoo development environments or deploying to production servers with Docker
What it does
This skill provides a complete, production-ready Docker setup for Odoo, including PostgreSQL, persistent file storage, environment variable configuration, and an optional Nginx reverse proxy with SSL. It covers both development and production configurations.
When to use - and when NOT to
Use this skill when spinning up a local Odoo development environment with Docker, deploying Odoo to a VPS or cloud server (AWS, DigitalOcean, etc.), troubleshooting Odoo container startup failures or database connection errors, or adding a reverse proxy with SSL to an existing Odoo Docker setup.
Do NOT use this skill for Odoo.sh cloud-managed hosting, which has a completely different deployment model. Avoid this approach if you need horizontal scaling with multiple Odoo containers behind a load balancer, as that requires shared filestore (NFS or S3-compatible storage) not covered here.
How it works
Mention the skill and describe your deployment scenario. The skill provides docker-compose.yml and odoo.conf configurations ready to run. Describe your container error and get a diagnosis with a fix.
Example configuration
Here's a production-ready docker-compose.yml:
services:
db:
image: postgres:15
restart: always
environment:
POSTGRES_DB: odoo
POSTGRES_USER: odoo
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- odoo-net
odoo:
image: odoo:17.0
restart: always
depends_on:
db:
condition: service_healthy
ports:
- "8069:8069"
- "8072:8072"
environment:
HOST: db
USER: odoo
PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- odoo-web-data:/var/lib/odoo
- ./addons:/mnt/extra-addons
- ./odoo.conf:/etc/odoo/odoo.conf
networks:
- odoo-net
volumes:
postgres-data:
odoo-web-data:
networks:
odoo-net:
Common operational commands:
# Start all services in background
docker compose up -d
# Stream Odoo logs in real time
docker compose logs -f odoo
# Restart Odoo only (not DB - avoids data risk)
docker compose restart odoo
# Stop all services
docker compose down
# Backup the database to a local SQL dump
docker compose exec db pg_dump -U odoo odoo > backup_$(date +%Y%m%d).sql
# Update a custom module without restarting the server
docker compose exec odoo odoo -d odoo --update my_module --stop-after-init
Best practices
Store all secrets in a .env file and reference them with ${VAR} - never hardcode passwords in docker-compose.yml. Use depends_on: condition: service_healthy with a PostgreSQL healthcheck to prevent Odoo starting before the DB is ready. Put Nginx in front of Odoo for SSL termination (Let's Encrypt / Certbot) - never expose Odoo directly on port 80/443. Set workers = (CPU cores × 2) + 1 in odoo.conf - workers = 0 uses single-threaded mode and blocks all users.
Never expose port 5432 (PostgreSQL) to the public internet - keep it on the internal Docker network only. Always pin to a specific patch-level tag (e.g., odoo:17.0) instead of using latest or 17 Docker image tags in production. Avoid mounting odoo.conf and relying on it for secrets in CI/CD - use Docker secrets or environment variables instead.
Limitations
This skill covers self-hosted Docker deployments. Odoo.sh cloud-managed hosting has a completely different deployment model. Horizontal scaling with multiple Odoo containers behind a load balancer requires shared filestore (NFS or S3-compatible storage) not covered here. Does not include an Nginx configuration template - consult the official Odoo Nginx docs for the full reverse proxy config. The addons_path inside the Docker image may change with new base image versions - always verify after upgrading the Odoo image.
Source README
This skill provides a complete, production-ready Docker setup for Odoo, including PostgreSQL, persistent file storage, environment variable configuration, and an optional Nginx reverse proxy with SSL. It covers both development and production configurations.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.