Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can odoo image support arm? #349

Open
ghost opened this issue Jan 6, 2021 · 42 comments
Open

Can odoo image support arm? #349

ghost opened this issue Jan 6, 2021 · 42 comments

Comments

@ghost
Copy link

ghost commented Jan 6, 2021

I'm trying dev odoo with apple silicon

@hoangtrann
Copy link

I'm trying dev odoo with apple silicon

Hey there, how is your journey so far? I would love to develop odoo on mac air m1 with 8gb of ram to see how it goes

@ghost
Copy link
Author

ghost commented Jan 10, 2021

I'm trying dev odoo with apple silicon

Hey there, how is your journey so far? I would love to develop odoo on mac air m1 with 8gb of ram to see how it goes

now I develop Odoo(12 and 13) with source install and change some version in requirement.txt

Pillow to 8.1.0
reportlab to 3.5.59

and setting terminal (in my case using iTerm) "Open using Rosetta"

if you wanna use docker it work too, install docker preview https://docs.docker.com/docker-for-mac/apple-m1/
no problem with postgres but odoo you must pull image by add using --platform linux/amd64 like
docker pull odoo:14 --platform linux/amd64

hope this help

@brandon-blb
Copy link

Hi.

I would just like to know if you got odoo working with the docker image on the M1 chip?

I am a Odoo developer and use docker. I am considering of getting a M1 Macbook but only if this works in docker.

@alxolivares
Copy link

Hello @brandon-blb
I've install the Apple M1 tech preview build available here and finally I used the following compose file to get Odoo up and running without problem:

version: "3.7"
services:
    odoo:
        image: odoo:14.0
        platform: linux/amd64
        container_name: odoo14
        depends_on:
            - postgresql
        tty: true
        stdin_open: true
        ports:
            - "8069:8069"
        volumes:
            - ./addons:/mnt/extra-addons
            - ./conf:/etc/odoo
        environment:
            - HOST=postgres12
    postgresql:
        image: postgres:12.4
        container_name: postgres12
        environment:
            - POSTGRES_DB=postgres
            - POSTGRES_PASSWORD=odoo
            - POSTGRES_USER=odoo

The --platform option recommended by @whileom save my life! 🤘

image

Hope this help!

@brandon-blb
Copy link

@alxolivares Thank you.

Cannot describe how much your feedback means to me. Ordering my M1 today :)

@whileom Can you maybe explain what the --platform flag does? Is it something new with the preview build of docker?

@alxolivares
Copy link

@brandon-blb
I'm glad this helps you

According to the documentation --platform indicates which version of the image will be pulled and/or on which platform. Unlike postgres, odoo does not have yet images available for other architecture than linux/amd64 if you try to make a pull without specifying this parameter you will get an error.

image_01
image_02

It was an unknown option to me but now I know. 👍

Kind regards

@iqbalwijonarko
Copy link

Hello @brandon-blb
I've install the Apple M1 tech preview build available here and finally I used the following compose file to get Odoo up and running without problem:

version: "3.7"
services:
    odoo:
        image: odoo:14.0
        platform: linux/amd64
        container_name: odoo14
        depends_on:
            - postgresql
        tty: true
        stdin_open: true
        ports:
            - "8069:8069"
        volumes:
            - ./addons:/mnt/extra-addons
            - ./conf:/etc/odoo
        environment:
            - HOST=postgres12
    postgresql:
        image: postgres:12.4
        container_name: postgres12
        environment:
            - POSTGRES_DB=postgres
            - POSTGRES_PASSWORD=odoo
            - POSTGRES_USER=odoo

The --platform option recommended by @whileom save my life! 🤘

image

Hope this help!

Do you have any step to install odoo 12 with docker? i'm still confused and keep getting this error:
image

Thank you.

@alxolivares
Copy link

Hello @iqbalthea
The following compose file should work

version: "3.7"
services:
    odoo:
        image: odoo:12.0
        platform: linux/amd64
        container_name: odoo12
        depends_on:
            - postgresql
        tty: true
        stdin_open: true
        ports:
            - "8069:8069"
        volumes:
            - ./addons:/mnt/extra-addons
            - ./conf:/etc/odoo
        environment:
            - HOST=postgres10
    postgresql:
        image: postgres:10
        container_name: postgres10
        environment:
            - POSTGRES_DB=postgres
            - POSTGRES_PASSWORD=odoo
            - POSTGRES_USER=odoo

image

Like a said before it's mandatory specify the platform: linux/amd64 parameter to avoid the error that you mention above.

Regards

@iqbalwijonarko
Copy link

Hello @iqbalthea
The following compose file should work

version: "3.7"
services:
    odoo:
        image: odoo:12.0
        platform: linux/amd64
        container_name: odoo12
        depends_on:
            - postgresql
        tty: true
        stdin_open: true
        ports:
            - "8069:8069"
        volumes:
            - ./addons:/mnt/extra-addons
            - ./conf:/etc/odoo
        environment:
            - HOST=postgres10
    postgresql:
        image: postgres:10
        container_name: postgres10
        environment:
            - POSTGRES_DB=postgres
            - POSTGRES_PASSWORD=odoo
            - POSTGRES_USER=odoo

image

Like a said before it's mandatory specify the platform: linux/amd64 parameter to avoid the error that you mention above.

Regards

this works like magic! thank you!

@its-leofisher
Copy link

Worked for me after getting the same error: #349 (comment)

@quiquemachado5
Copy link

Hello, trying to install Odoo on my MBA M1 with docker gives me this error and I am not able to solve it since I already have psycopg 2 installed, although error. Any ideas?
Captura de pantalla 2021-05-17 a las 13 19 09

@its-leofisher
Copy link

@quiquemachado5 Try with pip3

@quiquemachado5
Copy link

the same

@alxolivares
Copy link

@quiquemachado5
You tried using the compose file that I posted above? It should work without problem

@leimantas
Copy link

leimantas commented Aug 19, 2021

You can try to use my image: https://hub.docker.com/r/wbms/odoo14-multiarch

Or build docker image on your Mac m1. Just change wkhtmltopdf to this one: https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb

@Shahin-rmz
Copy link

I also have same problem when want to install Odoo on Raspberry pi.
it seems there is no supported version of it available right?

@quiquemachado5
Copy link

Already isn´t support on MacBooks M1, I solve this error using Parallels... I think we could use odoo in the M1 on 2022

@alxolivares
Copy link

alxolivares commented Oct 18, 2021

@quiquemachado5
I work every day with Odoo on my M1 (with docker) without any problems

@lukidoescode
Copy link

The above solutions did not do the trick for me on Raspberry Pi 4B. This machine is in theory capable to run Odoo just fine, since it's overclocked to 2 GHz.
With the platform: linux/amd64 solution performance goes to waste which could otherwise deliver a snappy developer experience.

A quick and simple solution to the problem could be to build the image using the command docker buildx build (https://docs.docker.com/engine/reference/commandline/buildx_build/). This and making sure the deb package works on arm64 should already do the trick. Since Odoo is built using python, this should be pretty straight forward.

@floflock
Copy link

floflock commented Nov 17, 2021

I just wanted to highlight that --dev=all or --dev=reload is not working due to this issue: #397

@Shahin-rmz
Copy link

Shahin-rmz commented Nov 18, 2021

A quick and simple solution to the problem could be to build the image using the command docker buildx build (https://docs.docker.com/engine/reference/commandline/buildx_build/). This and making sure the deb package works on arm64 should already do the trick. Since Odoo is built using python, this should be pretty straight forward.

very interesting, will check it out later on. now just tried to find another solution.

@hoangtrann
Copy link

You can actually build the image for arm64 yourself. Just need to clone this repo, replace wkhtmltopdf .deb from amd64 to arm64, correct the checksum and voila

@bluemix
Copy link

bluemix commented Jan 30, 2022

For me, I replaced
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \

with

&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb \

Checkout whkhtml releases.

Here is the full Dockerfile for Odoo 13.0:

FROM debian:buster-slim
MAINTAINER Odoo S.A. <info@odoo.com>

SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

# Generate locale C.UTF-8 for postgres and general locale data
ENV LANG C.UTF-8

# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN apt-get update \
        && apt-get install -y --no-install-recommends \
            ca-certificates \
            curl \
            dirmngr \
            fonts-noto-cjk \
            gnupg \
            libssl-dev \
            node-less \
            npm \
            python3-num2words \
            python3-pip \
            python3-phonenumbers \
            python3-pyldap \
            python3-qrcode \
            python3-renderpm \
            python3-setuptools \
            python3-slugify \
            python3-vobject \
            python3-watchdog \
            python3-xlrd \
            python3-xlwt \
            xz-utils \
        && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb \
#        && echo 'ea8277df4297afc507c61122f3c349af142f31e5 wkhtmltox.deb' | sha1sum -c - \
        && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
        && rm -rf /var/lib/apt/lists/* wkhtmltox.deb

# install latest postgresql-client
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
        && GNUPGHOME="$(mktemp -d)" \
        && export GNUPGHOME \
        && repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
        && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
        && gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
        && gpgconf --kill all \
        && rm -rf "$GNUPGHOME" \
        && apt-get update  \
        && apt-get install --no-install-recommends -y postgresql-client \
        && rm -f /etc/apt/sources.list.d/pgdg.list \
        && rm -rf /var/lib/apt/lists/*

# Install rtlcss (on Debian buster)
RUN npm install -g rtlcss

# Install Odoo
ENV ODOO_VERSION 13.0
ARG ODOO_RELEASE=20210816
ARG ODOO_SHA=b9ab34152fff8027ed2622cbbdc7b3387b2ab270
RUN curl -o odoo.deb -sSL https://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
#        && echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
        && apt-get update \
        && apt-get -y install --no-install-recommends ./odoo.deb \
        && rm -rf /var/lib/apt/lists/* odoo.deb

# Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/

# Set permissions and Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
RUN chown odoo /etc/odoo/odoo.conf \
    && mkdir -p /mnt/extra-addons \
    && chown -R odoo /mnt/extra-addons
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]

# Expose Odoo services
EXPOSE 8069 8071 8072

# Set the default config file
ENV ODOO_RC /etc/odoo/odoo.conf

COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py

# Set default user when running the container
USER odoo

ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]

@Shahin-rmz
Copy link

you could manage to make it work on Raspberry @bluemix ?

@bluemix
Copy link

bluemix commented Feb 13, 2022

what is the issue you have now? @Shahin-rmz

@Shahin-rmz
Copy link

what is the issue you have now? @Shahin-rmz

@bluemix I just couldn't manage to deploy odoo on Raspberry long ago. so just forgot about it.
now wanted to know if you could manage to install it correctly.

@adamflorizone
Copy link

adamflorizone commented Mar 19, 2022

No solution in this issue would resolve my container from not starting.

docker container logs:

standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error

The only way that I could get Odoo to work on Raspberry Pi OS (64-bit) was via pr #399 .

@gustavovalverde
Copy link

For anyone landing here with this issue, we're building https://github.com/iterativo-git/dockerdoo with arm64 and public images are available

@AaronBeaudoin
Copy link

AaronBeaudoin commented Jun 7, 2022

I'd personally really love to see some official Odoo arm64 images so I don't have to manually change the wkhtmltopdf URL myself and build locally like suggested above. Since it's really that small of a change to get it working, I'm wondering why we're not building official arm64 images already?

@leimantas
Copy link

leimantas commented Aug 11, 2022

Just change this line:
https://github.com/odoo/docker/blob/master/15.0/Dockerfile#L34

Into these:

RUN WKH_VERSION=$([ "$(uname -m)" = 'aarch64' ] && echo "arm64" || echo "amd64") \
    && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${WKH_VERSION}.deb \
    && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
    && rm -rf /var/lib/apt/lists/* wkhtmltox.deb

And build with docker buildx multiarch or just build on ARM or AMD.

@lekhnath
Copy link

lekhnath commented Dec 8, 2022

If you are getting following error message after you added code snippet provided by @leimantas :

#0 3.311 E: Unable to correct problems, you have held broken packages.

you might also need to update the repository list before installing the .deb package (ie. run apt-get update) as follows:

# Install Wkhtmltopdf
RUN WKH_VERSION=$([ "$(uname -m)" = 'aarch64' ] && echo "arm64" || echo "amd64") \
    && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${WKH_VERSION}.deb \
    && apt-get update \
    && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
    && rm -rf /var/lib/apt/lists/* wkhtmltox.deb

@Jeax2
Copy link

Jeax2 commented Apr 13, 2023

Hi, is possible install odoo16 in docker mac m1?

@leimantas
Copy link

Hi, is possible install odoo16 in docker mac m1?

Yes, you can build your after you do these changes. Or just can use this: https://hub.docker.com/r/wbms/odoo-16.0

@maxwell-kalin
Copy link

Why is that not merged/fixed?

@ludovic-gasc
Copy link
Contributor

Hi @ata-star and others,

I have made a pull request to support ARM: #466
It's not yet merged, but I hope soon.

Thanks for your tests and feedbacks

@maxwell-kalin
Copy link

want to deploy on Oracle servers soon

@lukas-the-wizard
Copy link

I tested on Oracle servers, works fine, can be used

@hemangjoshi37a
Copy link

anyone has odoo 17 running using docker ?

@elvsp1n
Copy link

elvsp1n commented Mar 29, 2024

I was able to install odoo 17 on a raspberry pi 4, 4gb of ram. Here is how:

# Install Ubuntu 22.04 on your arm64 device (ubuntu 22 vm inside your m1, ubuntu 22 os inside your raspberry pi, ubuntu 22 inside an lxd container running in your raspberry pi) and login as the ubuntu user with sudo privileges.

# Run the installer as explained on their official website
# https://www.odoo.com/documentation/17.0/contributing/development.html#contributing-development-setup
# OR

# Here is a brief script created from the official website
git clone --depth 1 https://github.com/odoo/odoo.git

# Confirm python version 3.10 or greater.
python3 --version

# Install db server
sudo apt install postgresql postgresql-client -y

# Create user and db
sudo -u postgres createuser -d -R -S ubuntu
createdb ubuntu

# Install odoo dependencies
cd odoo/
sed -n -e '/^Depends:/,/^Pre/ s/ python3-\(.*\),/python3-\1/p' debian/control | sudo xargs apt-get install -y
cd ..

# Install dependencies for wkhtmltox_0.12.6.1-3
# The following worked inside an lxd container but not for a VM in openstack
sudo apt install libfontenc1 xfonts-encodings xfonts-utils xfonts-75dpi xfonts-base -y

# The following worked for a VM in openstack and in theory, should also work on an lxd container
apt install libfontenc1 xfonts-encodings xfonts-utils xfonts-75dpi xfonts-base fontconfig libfontconfig1 fontconfig-config libjpeg-turbo8 libxrender1 fonts-dejavu-core ttf-bitstream-vera fonts-liberation2 fonts-liberation fonts-croscore fonts-freefont-otf fonts-freefont-ttf fonts-urw-base35 fonts-texgyre -y

# Download and install wkhtmltopdf
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_arm64.d
sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_arm64.deb

# Finally, run it. As this created a new database, you need to specify -i base. If you are running it on an existing db, don't run it with -i base.
cd odoo
python3 odoo-bin --addons-path=addons -d ubuntu -i base

# Now login to the ip of the raspberry pi, arm lxd container or arm vm
http://raspberripi_IP_ADDRESS:8069

# Username: admin
# Pass: admin

I would say that if it runs natively on a raspberry pi, it should also work on an m1 running natively on arm64 without needing an emulation. For those who like docker, the same script can be used to build an image on arm64 (pi4), just use a ubuntu image as a base and reuse the script to build the image.

Cheers,
EE

@lathama
Copy link

lathama commented Apr 2, 2024

@d-fence issue creator deleted their account. Can you close this issue.

@lathama
Copy link

lathama commented Apr 5, 2024

@odony issue creator deleted their account. Can you close this issue.

@hemangjoshi37a
Copy link

@lathama it is quite crazy to see that the deleted account had so many contributions and the profile was built like he really wanted to contribute and all of a sudden the account is deleted. I suspect something is wrong with this account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests