Introduction Odoo in Docker
Odoo is a powerful and versatile open-source business management software that can be a game-changer for your business. To simplify the process of setting up Odoo, we recommend using Docker. Docker allows you to create isolated environments for applications, making installation and configuration a breeze. In this step-by-step guide, we will show you how to install Odoo in Docker and have it up and running quickly.
Step 1: Prepare the Environment
First, For Odoo16 in Docker we need to create a new directory in the home directory and navigate into it. Open your terminal and execute the following commands:
mkdir -p ~/o16-d01
cd ~/o16-d01/
mkdir config
mkdir customize
Step 2: docker-compose odoo
Docker Compose is a powerful tool that simplifies the management of multi-container applications. By using a configuration file (docker-compose.yml), we can define the services, environments, and dependencies required for our Odoo setup.
Step 3: Configuring PostgreSQL using Docker Compose
Create a new file named myenvfile.env
and add the following PostgreSQL environment variables:
# postgresql env variables
POSTGRES_DB=postgres
POSTGRES_PASSWORD=odoo16
POSTGRES_USER=odoo16
PGDATA=/var/lib/pgsql/data/pgdata
# odoo env variables
HOST=postgres
USER=odoo16
PASSWORD=odoo16
Step 4: Create the docker-compose.yml
Now, let’s create the docker-compose.yml
file and define the Odoo and PostgreSQL services:
version: '3.1'
services:
odoo:
image: odoo:16.0
env_file: myenvfile.env
depends_on:
- postgres
ports:
- "8016:8069" # port mapping (custom-port:8016)
volumes:
- data:/var/lib/odoo
- ./config:/etc/odoo
- ./custom-addons:/mnt/customize
postgres
:
image: postgres:15
env_file: myenvfile.env
volumes:
- db:/var/lib/pgsql/data/pgdata
volumes:
data:
db:
Step 5: Configure Odoo
Create a custom configuration file for Odoo in the ./config
directory:
cd config
nano odoo.conf
Add the following content to the editor:
[options]
admin_passwd = admin_passwd
db_host = postgres
db_user = odoo16
db_password = odoo16
db_port = 5432
addons_path = /mnt/extra-addons
Step 6: Start Odoo with Docker Compose
For start Odoo16 in Docker. Ensure that your current directory is where the docker-compose.yml
file exists, and run the following command to start the Odoo instance:
docker-compose up
The terminal will display the logs. To run the containers in the background, add the -d
flag:
docker-compose up -d
Step 7: Accessing Odoo
Now, you can access your Odoo instance by visiting http://localhost:8016 in your web browser. You’ll be greeted by the Odoo setup wizard, and you can begin configuring your instance according to your business needs.
Conclusion
Congratulations! You have successfully installed Odoo using Docker, which provides an isolated and efficient environment for running the application. Docker’s flexibility and ease of use make managing Odoo a seamless experience.
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.
Pingback: Odoo 16 development with Docker and VSCode - teguhteja.id