What are Odoo and Docker?
Odoo is a business program. It has apps for sales, shop orders, accounting, stock and more.
Docker runs programs in containers. A container is like a lunch box that holds one program and all it needs. Odoo needs a database, so you will run two containers. One is the database (PostgreSQL). The other is Odoo.
Steps
- Log in to your server with SSH. SSH lets you type commands on a remote computer.
- Check that Docker works.
docker --version - Create a private network so the two containers can talk to each other.
docker network create odoo-net - Create a place to keep the database files, so they stay safe if a container is removed.
docker volume create odoo-db-data docker volume create odoo-web-data - Start the database container. Change
choose-a-strong-passwordto your own password.docker run -d --name odoo-db --network odoo-net \ -e POSTGRES_USER=odoo \ -e POSTGRES_PASSWORD=choose-a-strong-password \ -e POSTGRES_DB=postgres \ -v odoo-db-data:/var/lib/postgresql/data \ postgres:15 - Start the Odoo container. Use the same password.
Thedocker run -d --name odoo --network odoo-net -p 8069:8069 \ -e HOST=odoo-db -e USER=odoo -e PASSWORD=choose-a-strong-password \ -v odoo-web-data:/var/lib/odoo \ odoo-p 8069:8069part opens port 8069. A port is like a numbered door into your server. - Check that both containers run.
docker ps - If a firewall is on, allow the port. With UFW:
ufw allow 8069/tcp - Open a browser and go to
http://YOUR-SERVER-IP:8069. - Fill in the new database form. Give it a name, your email and a password. Then click Create database.
If something goes wrong
Look at the Odoo messages with this command. It shows the log, which is a diary of what the program did.
docker logs odoo
Tip: Back up your volumes before you update or remove containers. Removing a volume deletes your data for good.
Quick recap
- Odoo needs two containers: PostgreSQL and Odoo.
- Put them on one Docker network.
- Use volumes to keep your data safe.
- Open port 8069 in your browser to finish setup.