Docker image with imported volume runs on Docker for mac, fails with "exec format error" not Docker CE on Linux

  docker, linux, yocto

We’re building an OS image using yocto on Debian which outputs a bzipped volume which we can use as a base image in docker using docker import and we push this image to our registry to use as a base image.

cp build/tmp/deploy/images/raspberrypi4/device.tar.bz2 .
docker import device.tar.bz2 registry/base_image
docker push registry/base_image

We include the base image as part of another docker image:

FROM registry/base_image

ADD target/app.jar app.jar


This image is then successfully built by our CI on a linux (Amazon Linux 2) agent, and pushed to the registry. I’m able to pull the image and run it on a Mac with the current version of Docker for Mac.

However, trying to run the same docker image on a linux machine (even on the same linux build agent) results in the following exec format error:

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

Using an alternative docker image as the base allows the entrypoint to execute, so I’m pretty sure the issue is related to our custom base image.

As docker is largely cross platform, I’m surprised it works on MacOS but not Linux (tested in Ubuntu and Amazon Linux). I’ve tried both the Ubuntu and Docker hosted apt repositories for the docker install.

How can I further debug?

Source: Docker Questions