The main workstation running Fedora 31 now, devoid of any trace of
python2, I had to either spin up a virtual machine (which I happily did in the past using
libvirt or GNOME Boxes]) or get the hands dirty on containers this time to develop on Odoo  version 10 which depends on
python2. Faced with the challenge^Wopprotunity, I started to learn to use containers.
Never tried to use
docker, even though I am familiar with its technology and at times I wanted to try and have hands on experience on the technology. Fast forward,
buildah came along with the possibility to run root-less containers and they’re available in Fedora.
#Install $ su -c "dnf install -y podman buildah #Make sure your user is present in subuid and subgid $ su -c "usermod --add-subuids 10000-75535 $(whoami); \ usermod --add-subgids 10000-75535 $(whoami)" #Logout and login back for the normal user to take effect.
#Create a persistent storage location for DB $ su -c "mkdir -p /var/container/pgsql10/data" #Make sure to give ownership of the directory to 'postgres' user #in _container_. In host system, id of 'postgres' user is '26', #which maps to id '10025' in container. $ su -c "chown -R 10025:10025 -R !$" # directory created in previous step #As normal user $ podman run -d --name pg10 -e POSTGRESQL_USER=odoo \ -e POSTGRESQL_PASSWORD=odoopassword -e POSTGRESQL_ADMIN_PASSWORD=postgrespassword \ -e POSTGRESQL_DATABASE=postgres -p 9432:5432 \ -v /var/container/pgsql10/data:/var/lib/pgsql/data \ -m=1g rhscl/postgresql-10-rhel7 #Check logs $ podman logs -f pg10 #Connect the database and grant privileges to 'odoo' user $ psql -U postgres -h 192.168.1.100 -p 9342 -d postgres password: postgres=#ALTER USER odoo WITH CREATEDB;
These steps demand some comments. To setup persistent storage for database, create a directory and give ownership of that directory to the user in container (refer  for details) . The user id for
chown should be the mapped id of user within the container. For example, if the id of
postgres user is
25 in host system and the id of same user in container will usually be
Next you can pull the
postgresql docker image and run it. The environment variables using
-e option are passed into the container. The
-p option creates a port mapping between host and container. The
-v option provides volume (persistent storage) mapping between host directory and container directory. The
-m option provides
memory restrictions required for
postgres to auto-tune. If everything goes well, container named
pg10 is created and run as daemon process. Check the status using
podman ps -a or logs using
podman logs -f pg10.
We are running
postgresql as user
odoo and this user should be able to create databases. Login to the database using super user
postgres and the password specified in
POSTGRESQL_ADMIN_PASSWORD, connecting to the IP address of host machine (
localhost doesn’t work) on host port
9432. Then grant
CREATEDB privilege to the
postgresql is running successfully, let us create another container to run
odoo. We also want
odoo container to use the database server running in
pg10 container, connected using same
POSTGRESQL_USER user. There are couple of ways to connect to another container — one is using host port mapping and the other is using
pod, see  for details. I chose the first option. Before running the container, create volume mapping for configuration and addons directories.
#Configuration $ mkdir -p $HOME/odoo10_conf $ cat > $HOME/odoo10_conf/odoo.conf << EOF [options] ; podman postgresql communication using port mapping db_host = 192.168.1.100 db_port = 9432 db_user = odoo db_password = odoopassword addons_path = /mnt/extra-addons data_dir = /var/lib/odoo EOF #Create and run odoo container $ podman run -d -v $HOME/odoo10_conf:/etc/odoo \ -v /opt/odoo/addons/odoo10:/mnt/extra-addons -p 9010:8069 \ --name odoo10 odoo:10
We need to be able to control and pass the Odoo configuration from host system. Create a directory and place the configuration file in there and map it to
/etc/odoo/odoo.conf in container. Similarly, you would do addons development in your host machine, so map the addons directory which is expected at
/mnt/extra-addons by the container. The host port
9010 is mapped to container port
8069 used by Odoo.
Connect to Odoo by going to
localhost:9010 and build your next application.
Oh — you can stop the container using
podman stop pg10 and start using
podman start odoo10 etc.
- Odoo, https://odoo.com/
- Red Hat developer blog, Introduction to podman, https://developers.redhat.com/blog/2018/08/29/intro-to-podman/
- Red Hat developer blog, Podman and buildah for docker users, https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/
- Docker hub, PosgreSQL 10 on CentOS 7, https://hub.docker.com/r/centos/postgresql-10-centos7
- Red Hat documentation, Software collections docker images — PostgreSQL, https://access.redhat.com/documentation/en-us/red_hat_software_collections/3/html/using_red_hat_software_collections_container_images/database-images#postgresql
- Dan Walsh, Does root-less podman make sense? https://www.redhat.com/sysadmin/rootless-podman-makes-sense
- Red Hat, Configuring container networking with podman, https://www.redhat.com/sysadmin/container-networking-podman