首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用docker-compose启动CosmosDB模拟器?

如何使用docker-compose启动CosmosDB模拟器?
EN

Stack Overflow用户
提问于 2019-04-08 20:53:31
回答 3查看 2.3K关注 0票数 6

我在Visual Studio中有一个docker-compose项目,它启动了3个服务。其中一个使用cosmosdb。

我已经按照https://hub.docker.com/r/microsoft/azure-cosmosdb-emulator/上的说明在docker容器中启动了模拟器,并且它起作用了。

但现在我想通过docker-compose文件启动并运行它。以下是我的当前配置。

代码语言:javascript
复制
version: '3.4'

services:
  gateway:        
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    image: ${DOCKER_REGISTRY-}gateway
    ports:
      - "7000:80"
    depends_on:
      - servicea
      - serviceb
    build:
      context: .\ApiGateways\IAGTO.Fenix.ApiGateway
      dockerfile: Dockerfile

  servicea:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    image: ${DOCKER_REGISTRY-}servicea
    depends_on: 
      - email.db
    build:
      context: .\Services\ServiceA
      dockerfile: Dockerfile

  serviceb:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    image: ${DOCKER_REGISTRY-}serviceb
    build:
      context: .\Services\ServiceB
      dockerfile: Dockerfile

  email.db:
    image: microsoft/azure-cosmosdb-emulator
    container_name: cosmosdb-emulator
    ports:
      - "8081:8081"

当我运行docker container list时,可以看到容器正在运行

但是对https://localhost:8081/_explorer/index.html的请求失败了。

在这方面的任何帮助都非常感谢

EN

回答 3

Stack Overflow用户

发布于 2020-07-07 10:57:42

我也处于同样的情况,但是容器是用下面的docker-compose.yml启动的,它变得可以访问了。

我可以浏览https://localhost:8081/_explorer/index.html

代码语言:javascript
复制
version: '3.7'

services:
    cosmosdb:
        container_name: cosmosdb
        image: microsoft/azure-cosmosdb-emulator
        tty: true
        restart: always
        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"
        volumes:
            -  vol_cosmos:C:\CosmosDB.Emulator\bind-mount
        
volumes:
    vol_cosmos:   

可能我需要设置"tty“或"volumes”。

票数 3
EN

Stack Overflow用户

发布于 2019-05-10 04:13:54

部分问题是模拟器需要一段时间才能启动,并且在停止等待之前有2分钟的超时。我正在试着破解它,但我并没有取得太多成功。目前,镜像只能独立工作(通过docker run),仅此而已。

票数 0
EN

Stack Overflow用户

发布于 2021-06-23 01:39:03

使用linux cosmos db镜像,我将其设置如下:

代码语言:javascript
复制
version: '3.4'

services:
  db:
    container_name: cosmosdb
    image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator"
    tty: true
    restart: always
    mem_limit: 2G
    cpu_count: 2
    environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10
      - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=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"
    volumes:
       - vol_cosmos:/data/db

volumes: 
  vol_cosmos:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55573965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档