docker icon indicating copy to clipboard operation
docker copied to clipboard

Multiarchitecture support (arm, arm64)

Open samip5 opened this issue 4 years ago • 15 comments

This docker image needs multi-architecture builds so that it can be run on other architecture as well.

samip5 avatar Jun 25 '21 11:06 samip5

Anything particular is needed for arm support? I wouldn't mind adding arm support to my fork but I have no way to try this out.

llacroix avatar Jul 06 '21 22:07 llacroix

Anything particular is needed for arm support? I wouldn't mind adding arm support to my fork but I have no way to try this out.

Tehnically you only need to make multi-architecture images of it. Google will tell you how it's done.

samip5 avatar Jul 06 '21 22:07 samip5

From what I could gather, there is no "multi arch" image but more or less multiple images on the same tag through a multi manifest.

It doesn't seem to be possible to easily cross compile an arm image from amd64. So I'd need a VM or an actual device with ARM to build the images myself... Maybe docker hub is smart enough to select a build server on arm based on the docker file. I'll have to try that. Otherwise I just can't seem to build it.

llacroix avatar Jul 07 '21 04:07 llacroix

From what I could gather, there is no "multi arch" image but more or less multiple images on the same tag through a multi manifest.

It doesn't seem to be possible to easily cross compile an arm image from amd64. So I'd need a VM or an actual device with ARM to build the images myself... Maybe docker hub is smart enough to select a build server on arm based on the docker file. I'll have to try that. Otherwise I just can't seem to build it.

Docker hub's automated builder is not smart enough, and thus cannot build other architecture images.

samip5 avatar Jul 07 '21 04:07 samip5

Hmm but I think my issue is a bit different...

STEP 5: RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
standard_init_linux.go:228: exec user process caused: exec format error
Error: error building at STEP "RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb":
 error while running runtime: exit status 1

I'll have to remove wkhtmltopdf as there are no arm build as far as I know. That said, I do have a wkhtmltopdf server that can be used transparently to point to a remote pdf server... that's a possibility to use as replacement for pdf.

Edit:

There is 0.12.6r1

llacroix avatar Jul 07 '21 05:07 llacroix

Hmm but I think my issue is a bit different...

STEP 5: RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
standard_init_linux.go:228: exec user process caused: exec format error
Error: error building at STEP "RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb": error while running runtime: exit status 1

I'll have to remove wkhtmltopdf as there are no arm build as far as I know. That said, I do have a wkhtmltopdf server that can be used transparently to point to a remote pdf server... that's a possibility to use as replacement for pdf.

Umm, it sounds like youre trying to build it incorrectly.

You need to use Docker's buildx functionality most likely.

samip5 avatar Jul 07 '21 05:07 samip5

Hmm okay, I'll have to update my build script to use buildx but I think it should work transparently. I have a proof of concept that downloads the proper deb file for wkhtmltox. That said It's still unclear what else could go wrong with python deps.

llacroix avatar Jul 07 '21 18:07 llacroix

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

I made this change to original image. And it works.

https://hub.docker.com/r/wbms/odoo14-multiarch

Build command: docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag wbms/odoo14-multiarch:latest .

leimantas avatar Aug 20 '21 07:08 leimantas

I've got some progress on that btw, the only small issue is mainly that for some reasons docker buildx doesnt want to push to a private repository... I haven't figured out why yet but it's also possible to work with other versions than 0.12.6-1

I'm finishing how to improve the version selection of wkhtmltopdf to install and then I think I'll be able to push the docker images in multi arch once I get buildx to push images.

llacroix avatar Aug 26 '21 15:08 llacroix

It would be really nice if this is will be in the official image. Is there any plans to do so? We do need it for our developers with MacBook and M1 chips.

nischi avatar Nov 02 '21 04:11 nischi

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

I made this change to original image. And it works.

https://hub.docker.com/r/wbms/odoo14-multiarch

Build command: docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag wbms/odoo14-multiarch:latest .

I am using the odoo 15.0, modified the dockerfile similar to this and built it. It works good on my RaspberryPi 4 running with raspios arm64.

ExtremeXBB avatar Nov 02 '21 16:11 ExtremeXBB

Multi architecture support is also made possible with merge request #399.

sanderkwantes avatar Nov 22 '21 23:11 sanderkwantes

Thanks for this.

I'm using this approach to workaround the wkhtmltopdf: https://github.com/iterativo-git/dockerdoo/blob/13.0/Dockerfile#L55-L61

And building for both platforms using https://github.com/iterativo-git/dockerdoo/blob/13.0/.github/workflows/tests.yaml#L138

gustavovalverde avatar Feb 20 '22 06:02 gustavovalverde

Let me throw one more option into the ring: separate images for arm ( https://github.com/odoo/docker/pull/410 )

Tested on a M1 and it seems to work

derfl0 avatar Apr 10 '22 08:04 derfl0

Let's see if this gets merged:

  • https://github.com/docker-library/official-images/pull/15362

samip5 avatar Sep 14 '23 14:09 samip5