You're getting platform mismatch errors because Docker is trying to use AMD64 images on your ARM64 Mac.
cd alvik-ros2-docker
./scripts/build-arm64.shThis uses Dockerfile.arm64 which:
- Explicitly targets ARM64 platform
- Uses ROS2 Humble (better ARM64 support)
- Builds from Ubuntu base for reliability
- Installs only necessary components
Advantages:
- Faster build times
- More reliable on Apple Silicon
- Smaller image size
- Better compatibility
The original Dockerfile has been updated to support ARM64. Try:
cd alvik-ros2-docker
# Clean everything
docker system prune -a
# Rebuild
./scripts/build.shFix:
# Set default platform
export DOCKER_DEFAULT_PLATFORM=linux/arm64
# Or use the ARM64 build script
./scripts/build-arm64.shFix: The ARM64 Dockerfile installs packages individually to avoid this.
./scripts/build-arm64.shThis means the Docker image doesn't have an ARM64 version available.
Fix: Use the ARM64 Dockerfile which uses base images with ARM64 support:
./scripts/build-arm64.shFix: Allocate more resources to Docker Desktop:
- Open Docker Desktop
- Settings → Resources
- Set CPUs: 4-6 cores
- Set Memory: 6-8 GB
- Click "Apply & Restart"
If you see errors like:
Failed to create an OpenGL context - BadValue
Unable to create a suitable GLXContext
Unable to create the rendering window after 100 tries
Fix: The docker-compose.yml has been configured to use software rendering (llvmpipe) instead of hardware OpenGL, which isn't available in Docker on macOS.
After updating, rebuild:
docker compose down
docker compose build
docker compose up -d
docker compose exec ros2_alvik bashApple Silicon Macs run Docker through virtualization which can impact GUI performance.
Fixes:
-
Use software rendering (already configured in docker-compose.yml)
- This trades performance for compatibility
- RViz2 will work but may be slower than native Linux
-
Enable VirtioFS (faster file sharing):
- Docker Desktop → Settings → General
- Enable "VirtioFS accelerated directory sharing"
-
Enable Rosetta 2 (if available):
- Docker Desktop → Settings → Features in development
- Enable "Use Rosetta for x86/amd64 emulation on Apple Silicon"
-
Reduce rviz2 settings:
- Lower point cloud density
- Reduce update rates
- Disable unnecessary visualizations
Resources:
- CPUs: 4-6 cores
- Memory: 6-8 GB
- Swap: 2 GB
- Disk: 60 GB
General:
- ✓ Use VirtioFS accelerated directory sharing
- ✓ Use Rosetta for x86/amd64 emulation
Advanced:
- ✓ Allow the default Docker socket to be used
After building, verify everything works:
# Check platform
docker inspect alvik-ros2-docker_ros2_alvik:latest | grep Architecture
# Should show: "Architecture": "arm64"
# Test container
docker run --rm alvik-ros2-docker_ros2_alvik:latest uname -m
# Should show: aarch64# Stop all containers
docker stop $(docker ps -aq)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
docker rmi $(docker images -q)
# Prune system
docker system prune -a --volumes
# Restart Docker Desktop
# Rebuild with ARM64
cd alvik-ros2-docker
./scripts/build-arm64.sh- Use ARM64 native images - Much faster than emulated AMD64
- Allocate sufficient resources - Don't starve Docker of CPU/RAM
- Use VirtioFS - Dramatically improves file I/O
- Close unnecessary apps - Free up system resources
- Monitor Activity Monitor - Ensure Docker isn't thermal throttling
- Some ROS2 packages may not have ARM64 versions yet
- GPU acceleration for rviz2 is limited in Docker on macOS
- Network performance may be slightly slower than native Linux
If Docker continues to have issues, you can install ROS2 natively on macOS:
brew install ros
# But this is more complex and less isolatedThe Docker approach is still recommended for easier setup and portability.
If you're still stuck:
-
Check Docker Desktop logs:
- Docker Desktop → Troubleshoot → View logs
-
Check container logs:
docker logs alvik_ros2
-
Test MQTT separately:
brew install mosquitto mosquitto -v
-
Post on kevsrobots.com forums with:
- Mac model (M1/M2/M3)
- macOS version
- Docker Desktop version
- Full error message