Skip to content

Commit 0737275

Browse files
committed
Fix illegal instruction when starting mongo container on apple silicon in docker desktop
Docker Desktop's x86_64 emulation (DOCKER_DEFAULT_PLATFORM=linux/amd64) now uses Rosetta by default. However, Rosetta doesn't support AVX instructions that (the bitnami) mongo 7 image requires, causing "Illegal instruction" errors. Switch to QEMU emulation using EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1, which is slower but does support AVX.
1 parent e656566 commit 0737275

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

core/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ services:
5959
MONGODB_REPLICA_SET_MODE: primary
6060
MONGODB_REPLICA_SET_KEY: secretsecret
6161
MONGODB_ADVERTISED_HOSTNAME: mongodb
62+
# Force QEMU emulation instead of Rosetta for x86_64 Apple Silicon Macs.
63+
# Rosetta does not support AVX instructions, which this MongoD image requires, causing an
64+
# "Illegal instruction" error when starting the container:
65+
# /opt/bitnami/scripts/libos.sh: line 346: 50 Illegal instruction "$@" > /dev/null 2>&1
66+
EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU: 1
6267
volumes:
6368
- ./mongo/:/docker-entrypoint-initdb.d/
6469
- openconext_mongodb:/bitnami/mongodb

0 commit comments

Comments
 (0)