docker icon indicating copy to clipboard operation
docker copied to clipboard

Can odoo image support arm?

Open ghost opened this issue 3 years ago • 42 comments

I'm trying dev odoo with apple silicon

ghost avatar Jan 06 '21 04:01 ghost

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

hoangtrann avatar Jan 09 '21 12:01 hoangtrann

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

ghost avatar Jan 10 '21 12:01 ghost

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.

brandon-blb avatar Feb 22 '21 12:02 brandon-blb

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!

alxolivares avatar Mar 05 '21 01:03 alxolivares

@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?

brandon-blb avatar Mar 10 '21 11:03 brandon-blb

@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. :+1:

Kind regards

alxolivares avatar Mar 10 '21 12:03 alxolivares

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.

iqbalwijonarko avatar Mar 17 '21 01:03 iqbalwijonarko

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

alxolivares avatar Mar 17 '21 01:03 alxolivares

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!

iqbalwijonarko avatar Mar 17 '21 01:03 iqbalwijonarko

Worked for me after getting the same error: https://github.com/odoo/docker/issues/349#issuecomment-757472030

its-leofisher avatar May 05 '21 22:05 its-leofisher

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

quiquemachado5 avatar May 17 '21 11:05 quiquemachado5

@quiquemachado5 Try with pip3

its-leofisher avatar May 23 '21 06:05 its-leofisher

the same

quiquemachado5 avatar May 24 '21 17:05 quiquemachado5

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

alxolivares avatar May 24 '21 17:05 alxolivares

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

leimantas avatar Aug 19 '21 17:08 leimantas

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

Shahin-rmz avatar Oct 16 '21 09:10 Shahin-rmz

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

quiquemachado5 avatar Oct 18 '21 15:10 quiquemachado5

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

alxolivares avatar Oct 18 '21 16:10 alxolivares

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.

lukidoescode avatar Nov 16 '21 20:11 lukidoescode

I just wanted to highlight that --dev=all or --dev=reload is not working due to this issue: https://github.com/odoo/docker/issues/397

floflock avatar Nov 17 '21 07:11 floflock

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.

Shahin-rmz avatar Nov 18 '21 22:11 Shahin-rmz

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

hoangtrann avatar Nov 21 '21 07:11 hoangtrann

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. <[email protected]>

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"]

bluemix avatar Jan 30 '22 06:01 bluemix

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

Shahin-rmz avatar Feb 10 '22 18:02 Shahin-rmz

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

bluemix avatar Feb 13 '22 14:02 bluemix

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.

Shahin-rmz avatar Feb 13 '22 23:02 Shahin-rmz

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 .

adamflorizone avatar Mar 19 '22 22:03 adamflorizone

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

gustavovalverde avatar Apr 07 '22 12:04 gustavovalverde

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?

AaronBeaudoin avatar Jun 07 '22 15:06 AaronBeaudoin

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.

leimantas avatar Aug 11 '22 06:08 leimantas