CosmosDB 模拟器 Linux 映像 - 挂载卷

Ste*_*rke 3 linux docker azure-cosmosdb

将目录映射到 cosmosDB 模拟器 Linux docker 映像以便数据(数据库)保留在主机文件系统上的正确路径是什么?

 cosmosdb:
        container_name: cosmosdb
        image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
        mem_reservation: 3G
        cpu_count: 2
        tty: true
        ports:
            - "8081:8081"
            - "8900:8900"
            - "8901:8901"
            - "8979:8979"
            - "10250:10250"
            - "10251:10251"
            - "10252:10252"
            - "10253:10253"
            - "10254:10254"
            - "10255:10255"
            - "10256:10256"
            - "10350:10350"
        environment:
            AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 3
            AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: true
            AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: 127.0.0.1
        volumes:
           - ???
Run Code Online (Sandbox Code Playgroud)

对于 Windows 来说似乎是

C:/CosmosDB.Emulator/bind-mount
Run Code Online (Sandbox Code Playgroud)

我已经查看了正在运行的图像,但我不知道存储在哪个目录数据库/数据文件中......

通常,文档相当短 https://learn.microsoft.com/en-us/azure/cosmos-db/linux-emulator?tabs=sql-api%2Cssl-netstd21

它只是说

If the Cosmos DB emulator data folder is "volume mounted", ensure that the volume has enough space and is read/write.
Run Code Online (Sandbox Code Playgroud)

但是数据文件夹是什么?;)

Muh*_*mod 10

/tmp/cosmos/应用程序数据

通过在交互式中运行 docker 和“find / cosmos”命令找到了它...我没有得到任何找到的结果,但它输出了它扫描的所有目录的列表...并且我找到了该路径。刚刚测试过并且有效。

这是我的 docker-compose

version: '3.7'

networks:
  default:
    external: false
    ipam:
      driver: default
      config:
        - subnet: "172.16.238.0/24"

services:
  cosmosdb:
    container_name: "azurecosmosdbemulatorcontainer"
    hostname: "azurecosmosdbemulatorhostname"
    image:  mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
    platform: linux
    stdin_open: true
    tty: true
    mem_limit: 3GB
    ports:
      - '8081:8081'
      - '8900:8900'
      - '8901:8901'
      - '8902:8902'
      - '10250:10250'
      - '10251:10251'
      - '10252:10252'
      - '10253:10253'
      - '10254:10254'
      - '10255:10255'
      - '10256:10256'
      - '10350:10350'
    environment:
      AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 2
      AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: true
      AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: ${External_IP}
    networks:
      default:
        ipv4_address: 172.16.238.246
    volumes:
      - cosmosdrive:/tmp/cosmos/appdata

volumes:
  cosmosdrive:
  recipientdrive:
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述