Code Monkey home page Code Monkey logo

Comments (4)

aparcar avatar aparcar commented on July 26, 2024

Looks like you're already working on a PR to fix that, thanks!

from docker.

bwoodsend avatar bwoodsend commented on July 26, 2024

Hmm, almost. But MIPS is causing issues.

I added a dumb run it test which sure enough reproduces this ticket. Adding my hypothesised one line fix fixes every platform except MIPS which is raising Docker's not so informative wrong architecture error.

Running it locally gives me the same thing:

> docker build --platform linux/mips_24kc --build-arg 'DOWNLOAD_FILE=openwrt-.*-rootfs.tar.gz' --build-arg WORKDIR=/ --build-arg USER=root --build-arg VERSION_PATH=snapshots --build-arg TARGET=malta/be --build-arg BASE_IMAGE=scratch --build-arg CMD=ash .
[+] Building 2.6s (22/22) FINISHED                                                                                                                                                                                                            
 => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
...
 => => writing image sha256:b3d596932ac4091b06535b990144d701814f26af08d573bb4484430b362005d3                                                                                                                                             0.0s
> docker run --platform=linux/mips_24kc sha256:b3d596932ac4091b06535b990144d701814f26af08d573bb4484430b362005d3 uname -m
exec /bin/uname: exec format error

I wasn't too sure what Docker/qemu aliases as mips_24kc (for the --platform flag) so I downloaded the rootfs tarball and tried to empirically determine which qemu emulator it needs:

wget https://downloads.openwrt.org/snapshots/targets/malta/be/openwrt-malta-be-default-rootfs.tar.gz
tar xf openwrt-malta-be-default-rootfs.tar.gz
for qemu in /bin/qemu-*static; echo $qemu; $qemu lib/libc.so; end

qemu-mips-static is the emulator that matches the architecture of the binaries in that tarball which corresponds to --platform=linux/mips:

> docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes | grep mips
Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el

Setting --platform=linux/mips also doesn't work though:

> docker build --platform linux/mips -q --build-arg 'DOWNLOAD_FILE=openwrt-.*-rootfs.tar.gz' --build-arg WORKDIR=/ --build-arg USER=root --build-arg VERSION_PATH=snapshots --build-arg TARGET=malta/be --build-arg BASE_IMAGE=scratch --build-arg CMD=ash .
sha256:f8e5382d05afe40ea1618ba2dad3f1b2b1b3dd62a5dc744851b304682d465fbc
> docker run --platform=linux/mips sha256:f8e5382d05afe40ea1618ba2dad3f1b2b1b3dd62a5dc744851b304682d465fbc uname -m
exec /bin/uname: exec format error

I suspect that this reveals the cause:

> docker run --platform=linux/mips sha256:f8e5382d05afe40ea1618ba2dad3f1b2b1b3dd62a5dc744851b304682d465fbc /lib/libc.so
qemu-mipsn32-static: /lib/libc.so: Invalid ELF image for this architecture

Docker is using qemu-mipsn32-static instead of qemu-mips-static.

So unless you have any ideas, I think the best I can do is fix the others and disable MIPs rootfs then poke around the Docker community to see why Docker is using the wrong qemu emulator.

from docker.

aparcar avatar aparcar commented on July 26, 2024

@dangowrt do you have an idea on how to treat this?

from docker.

aparcar avatar aparcar commented on July 26, 2024

Thank you for the insights, very helpful! I'd be fine to drop it for now

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.