Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker run error 'exec format error' on Apple silicon M2 on docker desktop 4.27.2 #18217

Closed
biscout42 opened this issue Feb 20, 2024 · 18 comments
Labels
area/build-release co/docker-driver Issues related to kubernetes in container triage/duplicate Indicates an issue is a duplicate of other open issue.

Comments

@biscout42
Copy link

biscout42 commented Feb 20, 2024

What Happened?

I use Mac M2 Pro, MacOS Sonoma 14.3.1, Docker Desktop 4.27.2 with Rosetta enabled.

docker run --platform linux/amd64 -it ubuntu:latest bash

leads to the error

exec /usr/bin/bash: exec format error

Same happens with registry-creds addon, which is also available only for amd64

If I remove minikube via brew remove minikube and clean docker docker system prune -a , following command works:

docker run --platform linux/amd64 -it ubuntu:latest bash

Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
01007420e9b0: Pull complete
Digest: sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26bd5554491f0da
Status: Downloaded newer image for ubuntu:latest
root@956b98e29407:/#

Error started after updating Docker Desktop to version 4.27.2. While investigation original issue in docker desktop we found it is related to minikube.

How-to reproduce:

  • Install Docker Desktop 4.27.2 (137060)
  • run and delete minikube via
minikube start --cpus='8' --memory='16g' --disk-size '24g'
minikube stop
minikube delete
  • then run docker run --platform linux/amd64 -it ubuntu:latest bash

Attach the log file

* ==> Audit <==
* |---------|-------------------------------------------------------------|----------|---------|---------|---------------------|---------------------|
| Command |                            Args                             | Profile  |  User   | Version |     Start Time      |      End Time       |
|---------|-------------------------------------------------------------|----------|---------|---------|---------------------|---------------------|
| start   | --cpus=8 --memory=16g                                       | minikube | | v1.32.0 | 20 Feb 24 10:58 CET | 20 Feb 24 10:59 CET |
|         | --disk-size 24g                                             |          |         |         |                     |                     |
| stop    |                                                             | minikube | | v1.32.0 | 20 Feb 24 11:04 CET | 20 Feb 24 11:04 CET |
| delete  |                                                             | minikube | | v1.32.0 | 20 Feb 24 11:04 CET | 20 Feb 24 11:04 CET |
|---------|-------------------------------------------------------------|----------|---------|---------|---------------------|---------------------|

Operating System

macOS (Default)

Driver

Docker

@ofirbe
Copy link

ofirbe commented Feb 20, 2024

Hey @biscout42 ,
downgrade your docker version to 4.26.1 it will solve your issue (also , 4.27 not support minikube very well)

@biscout42
Copy link
Author

Hey @ofirbe , is it kinda chicken and egg problem? I mean: where community folks could rise an issue to make DD and minikube work happy together ❤️ ?

I mean DD folks say it is minikube issue, and here I hear opposite. Please, advice.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Feb 20, 2024

The reset of binfmt_misc is a minikube problem. It originated in ubuntu, but was inherited by kicbase.

It is not Dockers issue, just that their VM is hosting the shared kernel (problem does not occur with VM driver)

@afbjorklund
Copy link
Collaborator

afbjorklund commented Feb 20, 2024

Also, it has been fixed since

@biscout42
Copy link
Author

Ough, that explains why gcr.io/k8s-minikube/kicbase-builds:v0.0.42-1703092832-17830 image works. Thanks, @afbjorklund , that makes sense.

Which kicbase-builds version would you suggest to use before the fix ends up in the gcr.io/k8s-minikube/kicbase?

@afbjorklund afbjorklund added area/build-release triage/duplicate Indicates an issue is a duplicate of other open issue. co/docker-driver Issues related to kubernetes in container labels Mar 20, 2024
@harshitrjpt
Copy link

I don't know about any fixes in the latest version, but this issue is still happening on

Apple M1 Pro, macOS 14.4
Docker Desktop 4.28.0 (139021)
minikube 1.32

@pre
Copy link

pre commented Mar 28, 2024

I don't know about any fixes in the latest version, but this issue is still happening on

The latest release is from November. 🤷🏻‍♂️

#18250

@afbjorklund
Copy link
Collaborator

@harshitrjpt
Copy link

harshitrjpt commented Mar 28, 2024

https://github.com/kubernetes/minikube/releases/tag/v1.33.0-beta.0

This beta release still has the issue (if you mentioned this release as a fix). PFA screenshot showing the issue in action.
Screenshot 2024-03-29 at 12 22 53 AM

@eveletspb
Copy link

same error

https://github.com/kubernetes/minikube/releases/tag/v1.33.0-beta.0

This beta release still has the issue (if you mentioned this release as a fix). PFA screenshot showing the issue in action. Screenshot 2024-03-29 at 12 22 53 AM

@nevotheless
Copy link

nevotheless commented Apr 19, 2024

I've the same issue after installing the 1.33.0-beta.0 release via homebrew. I've previously removed the old minikube cluster and removed the package.

Do we have to reset the docker desktop vm as well for this to work? (Using Docker 4.29.0)

Feels like minikube trying to play fetch with docker desktop release now 😄

@dasumner
Copy link

I don't seem to be able to downgrade my way out of this. I've tried going back to 4.26.1 as suggested by @ofirbe, but I still keep getting the error. Is there a formula for Minikube/Docker Desktop that's known to work?

@adityasamant25
Copy link

I don't seem to be able to downgrade my way out of this. I've tried going back to 4.26.1 as suggested by @ofirbe, but I still keep getting the error. Is there a formula for Minikube/Docker Desktop that's known to work?

There is, but it involves a docker system prune, that means it will wipe out all your docker images, containers and volumes.
So you will need to be 100% sure that you do not need any of your deployments on Docker Desktop anymore before trying it.
If there are important deployments, then don't follow these steps and you may need some other solution.

The details are here: docker/for-mac#7168 (comment)

The commands that help me overcome this are:

  1. brew remove minikube

  2. docker system prune -a

  3. Shutdown and restart Docker Desktop (Docker engine reboot).

  4. Test that the below command runs successfully and you are able to exec into an ubuntu container for amd64 platform
    docker run --platform linux/amd64 -it ubuntu:latest bash

  5. brew install minikube

  6. Start minikube using a very specific base image
    minikube start --base-image gcr.io/k8s-minikube/kicbase-builds:v0.0.42-1703092832-17830

  7. Try to run a Pod that uses a amd64 image on minikube, it is supposed to run.

@pre
Copy link

pre commented Apr 19, 2024

In our team, the v1.33.0-beta.0 Release has fixed the exec format error with the newer kicbase image.

However, an existing minikube cluster needs to be deleted and recreated after upgrading minikube.

@dasumner
Copy link

The newer base-image seems to have done the trick. Thank you very much.

@nevotheless
Copy link

I've just more or less tried what @adityasamant25 did #18217 (comment).

Previous attempts didn't work for me since i never reset my docker system, which seems to also reset the binfmt shenanigans a previous minikube version setup which became incompatible. (Atleast that's my headcanon now).

As of today a clean

  • Docker (Desktop on Mac) Version 26.0.0 and a clean via Homebrew installed
  • minikube Version v1.33.0 using kicbase image gcr.io/k8s-minikube/kicbase:v0.0.43 (which is default atm, i didn't put a custom image)

works again as intended.

@bkuhl
Copy link

bkuhl commented May 20, 2024

I encountered this error while running minikube up on an M1 for the first time (not a new machine, long history of using docker/compose) using the latest Minikube. The minikube delete && docker system prune -a fixed it for me.

@biscout42
Copy link
Author

I would close it, because it works 🎉 . Thanks the the team.

Verified with

  • Docker desktop 4.30.0
  • Minikube 1.33.1

To refresh system please use suggestion from @adityasamant25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build-release co/docker-driver Issues related to kubernetes in container triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
Development

No branches or pull requests

10 participants