This repository provides a streamlined setup for running Odoo using Docker Compose, with options for both standard deployment and customized builds.
- Odoo 18.0 with PostgreSQL 17
- Choice between official DockerHub image and custom build
- Secure password generation
- Volume mapping for addons and configuration
- Automatic environment setup
- Support for custom Python packages
- Development mode enabled by default
- Docker
- Docker Compose
- Git
- Bash shell
- sudo privileges (for Linux systems)
.
├── .env.template
├── docker-compose.yml
├── docker-compose.build.yml
├── run.sh
├── docker/
│ └── odoo/
│ ├── Dockerfile
│ └── entrypoint.sh
├── etc/
│ ├── odoo.conf.template
│ └── requirements.txt
├── addons/
│ └── .gitkeep
└── .gitignore
- Clone this repository:
git clone https://github.com/lent85/odoo-docker-compose.git
cd odoo-docker-compose
- Make the run script executable:
chmod +x run.sh
- Run the setup script:
For standard deployment (using DockerHub image):
./run.sh /path/to/destination 8069 8072
For custom build deployment:
./run.sh /path/to/destination 8069 8072 build
Parameters:
- First argument: Destination path
- Second argument: Main Odoo port (default: 8069)
- Third argument: Chat port (default: 8072)
- Fourth argument (optional): Use "build" for custom build
The following environment variables are automatically configured in .env
:
ODOO_PORT
: Main Odoo web interface portCHAT_PORT
: Odoo live chat portPOSTGRES_DB
: PostgreSQL database namePOSTGRES_USER
: PostgreSQL userPOSTGRES_PASSWORD
: Auto-generated secure passwordADMIN_PASSWORD
: Auto-generated admin password
To add custom Python packages:
- Edit
etc/requirements.txt
- Add your required packages
- Restart the containers
Place your custom Odoo modules in the addons
directory. They will be automatically detected by Odoo.
The environment starts automatically after running the setup script. To manually control the environment:
# Start the environment
docker-compose up -d
# Stop the environment
docker-compose down
# View logs
docker-compose logs -f
# Restart the environment
docker-compose restart
- Main Interface:
http://localhost:8069
(or your configured port) - Live Chat:
http://localhost:8072
(or your configured port)
Initial database creation credentials are stored in .secret
file in your destination directory.
Development mode is enabled by default in odoo.conf
, allowing for:
- Module hot-reloading
- Debug mode
- Developer tools access
- Secure passwords are automatically generated
- Credentials are stored in a protected
.secret
file - Proper file permissions are set automatically
- Environment variables are secured
To backup your data:
# Stop the environment
docker-compose down
# Backup the postgresql directory
tar -czf odoo_data_backup.tar.gz postgresql/
# Backup custom addons
tar -czf odoo_addons_backup.tar.gz addons/
For the DockerHub version:
docker-compose down
docker-compose pull
docker-compose up -d
For the custom build version:
docker-compose -f docker-compose.build.yml down
docker-compose -f docker-compose.build.yml build --no-cache
docker-compose -f docker-compose.build.yml up -d
-
Port already in use
- Change the ports in your
.env
file - Restart the environment
- Change the ports in your
-
Permission Issues
sudo chown -R $(id -u):$(id -g) /path/to/destination
-
Inotify Watches Limit (Linux)
- Automatically configured by the setup script
- Manual configuration:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
View logs for debugging:
# All services
docker-compose logs -f
# Odoo only
docker-compose logs -f web
# PostgreSQL only
docker-compose logs -f db
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.