containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/mongodb] Mongodb doesn't run on M1 Mac

Open tclasen opened this issue 2 years ago • 37 comments

Name and Version

bitnami/mongodb:5.0.10-debian-11-r3

What architecture are you using?

arm64

What steps will reproduce the bug?

I'm actually trying to run the Bitnami helm chart for Mongodb running in minikube on a M1 Mac. But I can replicate the problem with: docker run --rm -it docker.io/bitnami/mongodb:5.0.10-debian-11-r3

What is the expected behavior?

I would like to see aarch64 (arm64) images published to dockerhub for 5.0.10 and newer versions of Mongo.

What do you see instead?

docker run --rm -it docker.io/bitnami/mongodb:5.0.10-debian-11-r3

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
mongodb 20:51:20.14
mongodb 20:51:20.17 Welcome to the Bitnami mongodb container
mongodb 20:51:20.18 Subscribe to project updates by watching https://github.com/bitnami/containers
mongodb 20:51:20.20 Submit issues and feature requests at https://github.com/bitnami/containers/issues
mongodb 20:51:20.22
mongodb 20:51:20.24 INFO  ==> ** Starting MongoDB setup **
mongodb 20:51:20.35 INFO  ==> Validating settings in MONGODB_* env vars...

It hangs on this step forever. In the k8s template, the pod is restarted due to being detected as stuck and timed out.

I've tried to build these myself using the bitnami/containers repo, but I get the following error:

0.752 mongodb-shell-1.10.1-0-linux-arm64-debian-11.tar.gz: OK
1.540 yq-4.34.2-0-linux-arm64-debian-11.tar.gz: OK
1.697 wait-for-port-1.0.6-9-linux-arm64-debian-11.tar.gz: OK
1.814 render-template-1.0.5-7-linux-arm64-debian-11.tar.gz: OK
2.014 sha256sum: mongodb-5.0.18-1-linux-arm64-debian-11.tar.gz.sha256: no properly formatted SHA256 checksum lines found
Dockerfile:26

Additional information

According to the mongo forums the x86 binary requires the AVX CPU flag which isn't provided by the Rosetta x86 emulator, meaning it is expected that the x86 version of mongo would never be able to run on the aarch64 (arm64) architecture of a M1 Mac. https://www.mongodb.com/community/forums/t/mongodb-docker-container-not-starting-properly/160540

tclasen avatar Jul 13 '23 21:07 tclasen

I was just going to open this exact ticket myself. mongo:5.0 arm64 image runs fine on m1/m2 for example.

@javsalgar is there any way I can help? I was looking at the existing workflows thinking about opening a pr, but doesn't seem like the build/release part of the automation is on github.

Having this fixed would be quite valuable for us at @RocketChat

debdutdeb avatar Jul 14 '23 06:07 debdutdeb

Found these https://github.com/bitnami/charts/issues/7305 https://github.com/bitnami/charts/issues/7305#issuecomment-1443187343

debdutdeb avatar Jul 14 '23 06:07 debdutdeb

Hi!

I'm afraid we currently don't have support for Debian 11 ARM. As soon as we add support for this, we will notify the community

javsalgar avatar Jul 14 '23 08:07 javsalgar

We have been using this unofficial mirror of bitnami/mongodb image that supports arm64 https://hub.docker.com/r/zcube/bitnami-compat-mongodb. In case someone else finds it useful.

MargaretKrutikova avatar Aug 07 '23 09:08 MargaretKrutikova

We have been using this unofficial mirror of bitnami/mongodb image that supports arm64 https://hub.docker.com/r/zcube/bitnami-compat-mongodb. In case someone else finds it useful.

Cheers for this! exactly what I needed today!

saintdle avatar Aug 08 '23 11:08 saintdle

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Aug 24 '23 01:08 github-actions[bot]

// not stale.

debdutdeb avatar Aug 24 '23 06:08 debdutdeb

We're using Apple Silicon as well and rather not rely on a workaround but stay with the Bitnami implementation (as we're using RocketChat and RocketChat suggests to use the Bitnami MongoDB image).

Therefor I wonder; does anyone have an update or estimation on this issue? Apple Silicon is out for a rather long time and here to stay I think. Is this issue deemed fixable and on a road map, or would it be best for us to plan under the assumption it won't be fixed in any foreseeable future?

markverg avatar Aug 31 '23 09:08 markverg

At this moment there is not a bitnami/mongodb multiarch image available. Having said that, we have an internal task still on our backlog to revisit the unsupported apps. We'll update this thread once done the mentioned task

carrodher avatar Sep 04 '23 11:09 carrodher

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Sep 20 '23 01:09 github-actions[bot]

// not stale

debdutdeb avatar Sep 20 '23 07:09 debdutdeb

Seconding // not stale too

omgsian avatar Oct 12 '23 18:10 omgsian

We are experiencing the same issues in our company. Our engineers have all migrated to m1s or m2s and since we upgraded to mongo 6.0.10 we are unable to run the bitnami images on our local machines. We would very much appreciate a fix being put in for this

dgriff67 avatar Oct 19 '23 08:10 dgriff67

Also interested in the solution here

rlreamy avatar Oct 24 '23 20:10 rlreamy

any updates on this topic?

LittleHoopoe avatar Nov 02 '23 14:11 LittleHoopoe

+1

richardcresswell avatar Nov 02 '23 14:11 richardcresswell

Hi every one, today I was finally able to install mongo v. 6.0.11 in a k3d Kubernetes cluster on my MacBook with M1 chip. Mongo is installed via the operator, which on arm machines does a problem as the mongo-agent it installs doesn't have an arm64 image yet. See here https://github.com/mongodb/mongodb-kubernetes-operator/issues/1420#issuecomment-1790885017.

Cheers

vinnytwice avatar Nov 02 '23 15:11 vinnytwice

tryed today the mongodb-14.0.14 and v13.18.5 chart both with now luck... image

LittleHoopoe avatar Nov 03 '23 09:11 LittleHoopoe

Still actual for Mac M1

DmitryAurum avatar Jan 05 '24 09:01 DmitryAurum

Teammate just ran into the same problem on his Mac M1

KaurKadakWise avatar Jan 11 '24 11:01 KaurKadakWise

At this moment there is not a bitnami/mongodb multiarch image available. Having said that, we have an internal task still on our backlog to revisit the unsupported apps. We'll update this thread once done the mentioned task

@carrodher Any update or ETA on that task?

solocommand avatar Jan 18 '24 17:01 solocommand

The latest version of MongoDB does not yet support ARM: https://www.mongodb.com/try/download/community. ARM is only supported on Ubuntu and MacOS while our catalog is based on Debian.

carrodher avatar Jan 18 '24 20:01 carrodher

Same problem 🥲

izakdvlpr avatar Jan 31 '24 10:01 izakdvlpr

Working on an M1 after upgrading to Docker Desktop 4.27.1 (Docker Engine 25.0.2) and enabling the EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU environment variable.

Example: docker run -e EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1 --rm -it docker.io/bitnami/mongodb:7.0

https://github.com/docker/for-mac/issues/6620

borodiliz avatar Feb 01 '24 22:02 borodiliz

@borodiliz hey, I am new to this, could you tell me how can I enable the variable in a docker compose based project?

DarhkVoyd avatar Feb 05 '24 13:02 DarhkVoyd

@borodiliz hey, I am new to this, could you tell me how can I enable the variable in a docker compose based project?

@DarhkVoyd Sure. Same as other environment variables. Here is a complete example:

version: "3.8"
services:
  mongo: 
    image: bitnami/mongodb:5.0
    environment:
      - MONGODB_ADVERTISED_HOSTNAME=127.0.0.1
      - MONGODB_REPLICA_SET_MODE=primary
      - MONGODB_ROOT_USER=elon
      - MONGODB_ROOT_PASSWORD=supersecret
      - MONGODB_REPLICA_SET_KEY=foobar123
      - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1 # This is required on Apple Silicon https://github.com/docker/for-mac/issues/6620
    ports:
      - "27017:27017"
    volumes:
      - "mongo-db:/bitnami/mongodb"
volumes:
  mongo-db:

borodiliz avatar Feb 05 '24 13:02 borodiliz

@borodiliz

Finally!! It worked, thank you so much you are life saver. I wasted my entire week on this error. Should I also explicity set platform: linux/amd64.

DarhkVoyd avatar Feb 05 '24 13:02 DarhkVoyd

Thanks @borodiliz!

EDIT: Please use this for local development ONLY!!!

For those using Helm, you can include this in the values file:

extraEnvVars:
  - name: EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU
    value: 1

neha-viswanathan avatar Feb 28 '24 07:02 neha-viswanathan

Guys, quemu emulation workaround is not suitable for Kubernetes use and not suitable for Production environments at all. Its only workaround for some dev envs, not a solution yet.

farcop avatar Apr 03 '24 08:04 farcop

The workaround for local development works 🎉 . However I had to turnoff rosetta acceleration in Docker Desktop settings (Apple virtualization and virtIO can be enabled).

arnoldpistorius avatar Jun 10 '24 09:06 arnoldpistorius