You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apple M1 Pro安装Azure Cosmos DB模拟器遇地址映射错误求助

解决Apple M1 Pro芯片Mac上Azure Cosmos DB模拟器Docker运行地址映射错误

修正后的操作步骤

  • 拉取指定平台的模拟器镜像:
ipaddr="`ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -n 1`"
docker pull --platform linux/amd64 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
  • 运行容器时添加--platform linux/amd64参数:
docker run \
    --platform linux/amd64 \
    --publish 8081:8081 \
    --publish 10250-10255:10250-10255 \
    --memory 3g --cpus=2.0 \
    --name=test-linux-emulator1 \
    --env AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10 \
    --env AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true \
    --env AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=$ipaddr \
    --interactive \
    --tty \
    mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator

错误原因说明

你遇到的错误信息:

./cosmosdb-emulator: ERROR: Invalid mapping of address 0x40037db000 in reserved address space below 0x400000000000. Possible causes:

  1. the process (itself, or via a wrapper) starts-up its own running environment sets the stack size limit to unlimited via syscall setrlimit(2);
  2. the process (itself, or via a wrapper) adjusts its own execution domain and flag the system its legacy personality via syscall personality(2);
  3. sysadmin deliberately sets the system to run on legacy VA layout mode by adjusting a sysctl knob vm.legacy_va_layout.

这是因为Apple M1 Pro采用arm64架构,而Azure Cosmos DB Linux模拟器仅提供amd64版本的二进制文件,直接运行会触发内存地址空间的映射冲突。添加--platform linux/amd64参数后,Docker会启用Rosetta 2来模拟x86_64运行环境,解决架构不兼容带来的地址映射问题。

内容的提问来源于stack exchange,提问作者archit agarwal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 22:50:29