exec format error

Deploying a service on a new machine, I ran into a problem. Some services did not want to start, and the error was very cryptic

$ docker-compose logs
Attaching to foo-service_1, bar_1
foo-service_1  | standard_init_linux.go:211: exec user process caused "exec format error"
bar_1          | standard_init_linux.go:211: exec user process caused "exec format error"

I checked the architecture

$ docker foo image | grep Arch
        "Architecture": "arm64",

the server was

$ uname -a
Linux 4.15.0-118-generic 119-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

Solution

Rebuild for the correct arch

docker build --platform ${arch} . \
    -t ${docker_namespace}/${docker_project_name}:${arch}-${docker_version} \
    -f ${path}/Dockerfile

valid values for arch are

  • amd64
  • arm64
Tags: Docker DevOps