Docker image to build MongoDB from source without AVX CPU instruction requirements. This is designed for use with mbentley/docker-omada-controller on older CPUs that don't support AVX instructions.
Based on the work from alanedwardes/mongodb-without-avx, updated for MongoDB 7.x with SCons build system.
Pre-built images are available from GitHub Container Registry:
docker pull ghcr.io/fenio/mongodb-no-avx:7.0.28
docker pull ghcr.io/fenio/mongodb-no-avx:7.0
docker pull ghcr.io/fenio/mongodb-no-avx:7
docker pull ghcr.io/fenio/mongodb-no-avx:latest # Same as 7.0.28MongoDB 5.0+ requires AVX (Advanced Vector Extensions) CPU instructions by default. Many older CPUs (pre-2011) and some virtualization platforms don't support AVX. This project builds MongoDB from source with AVX optimizations disabled.
MongoDB 7.x uses SCons build system with the experimental-optimization option that defaults to +sandybridge, which sets -march=sandybridge compiler flag requiring AVX support. This build patches the SConstruct to remove the sandybridge default, allowing MongoDB to use a generic x86-64 baseline:
- Does NOT require AVX instructions
- Works on Intel Westmere (2010) and newer, AMD Bulldozer (2011) and newer
- Compatible with virtualization platforms that don't expose AVX
docker build -t mongodb-no-avx:7.0.28 .docker build \
--build-arg MONGO_VERSION=7.0.28 \
--build-arg NUM_JOBS=4 \
-t mongodb-no-avx:7.0.28 .Build Arguments:
MONGO_VERSION: MongoDB version to build (default:7.0.28)NUM_JOBS: Number of parallel SCons build jobs (leave empty for auto-detect)
Note: Building MongoDB from source takes a LONG time (2-6+ hours depending on your hardware) and requires significant resources:
- RAM: 8GB+ recommended
- Disk: 30GB+ free space
- CPU: More cores = faster build
docker run -d \
--name mongodb \
-p 27017:27017 \
-v mongodb-data:/data/db \
ghcr.io/fenio/mongodb-no-avx:7.0.28Use docker-compose.yml for bridge networking mode:
docker compose up -dThis will:
- Pull/build the MongoDB image
- Start MongoDB container
- Start Omada Controller connected to the external MongoDB
Use docker-compose.host.yml for host networking mode (better for device discovery):
docker compose -f docker-compose.host.yml up -dWhen using external MongoDB with Omada Controller, set these environment variables:
environment:
- MONGO_EXTERNAL=true
- EAP_MONGOD_URI=mongodb://mongodb-host:27017/omadaThe connection string format is:
mongodb://[username:password@]host:port/database
For local/container networking:
- Bridge mode:
mongodb://omada-mongodb:27017/omada - Host mode:
mongodb://127.0.0.1:27017/omada
The build supports MongoDB 7.0.x versions. To build a specific version:
# MongoDB 7.0.28 (default - recommended for Omada Controller)
docker build --build-arg MONGO_VERSION=7.0.28 -t mongodb-no-avx:7.0.28 .Note: MongoDB 8.x uses Bazel build system which has enterprise module dependencies that complicate community builds. This Dockerfile is optimized for MongoDB 7.x which uses the SCons build system.
/data/db- MongoDB data directory/data/configdb- MongoDB configuration database (for sharded clusters)
27017- MongoDB default port
MongoDB/SCons compilation can be memory-intensive. If you run out of memory:
- Increase Docker memory limits (8GB+ recommended)
- Reduce
NUM_JOBSbuild argument - Add swap space to your system
SCons builds require significant disk space:
- Ensure 30GB+ free space
- Clean Docker build cache:
docker builder prune - Remove old images:
docker image prune -a
Check logs:
docker logs mongodbCommon issues:
- Data directory permissions
- Port already in use
- Insufficient system resources
- Verify MongoDB is running:
docker ps - Check MongoDB logs:
docker logs omada-mongodb - Verify network connectivity between containers
- Ensure
MONGO_EXTERNAL=trueis set - Verify the
EAP_MONGOD_URIis correct
MongoDB 7.x builds with SCons and uses the experimental-optimization option in SConstruct that defaults to ['+sandybridge']. This sets architecture-specific compiler flags:
-march=sandybridge -mtune=generic -mprefer-vector-width=128
The patch changes the default to [] (empty), which allows MongoDB to use the standard x86-64 baseline without AVX requirements.
This project follows the same licensing as the original mongodb-without-avx project (GPL-3.0).
MongoDB itself is licensed under the Server Side Public License (SSPL).