microsoft / microsoft/vscode-azureresourcegroups

[CoR] Default Cosmos DB config fails

Open Beginner friendly
#1,654 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
78
Forks
55
Avg merge
16h 49m
Merged PRs (30d)
139

Description

With the default setup, the cosmosdb container never starts up and the compose command eventually times out. Copilot is able to fix it and explains the issue:

AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=127.0.0.1 — this forces the emulator's internal certificate to bind to loopback, which can cause conflicts inside the container's network namespace. Removing it lets the emulator use its default address.

The emulator is hitting a fatal error (0xC0000001) in its internal AppLoader. This is a known issue with the Cosmos DB Linux emulator when using bind-mounted volumes on Docker Desktop for Windows — the emulator's internal SQL PAL layer has compatibility issues with NTFS-backed bind mounts.

The fix is to replace the bind mount with a named Docker volume (or remove data persistence entirely since the migration service recreates containers on startup anyway)

It makes changes to the compose config

Image
full docker-compose.yml
services:
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    command: azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --skipApiVersionCheck
    ports:
      - "10000:10000"
      - "10001:10001"
      - "10002:10002"
    volumes:
      - ./.azurite:/data
    restart: unless-stopped

  cosmos-emulator:
    image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
    ports:
      - "8081:8081"
      - "10250:10250"
      - "10251:10251"
      - "10252:10252"
      - "10253:10253"
      - "10254:10254"
    environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=3
    volumes:
      - cosmos-data:/tmp/cosmos/appdata
    healthcheck:
      test: [ "CMD-SHELL", "curl -ks https://localhost:8081/_explorer/emulator.pem || exit 1" ]
      interval: 10s
      timeout: 5s
      retries: 30
      start_period: 60s
    restart: unless-stopped

  db-migrate:
    image: node:24-slim
    working_dir: /app/services/microblog-api
    depends_on:
      cosmos-emulator:
        condition: service_healthy
    volumes:
      - ./:/app:ro
      - ./node_modules:/app/node_modules:ro
    environment:
      COSMOSDB_CONNECTION_STRING: "AccountEndpoint=https://cosmos-emulator:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
      COSMOSDB_DATABASE_NAME: "microblog"
      NODE_TLS_REJECT_UNAUTHORIZED: "0"
    entrypoint: [ "npm", "run", "migrate" ]
    restart: "no"

volumes:
  cosmos-data:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the default docker-compose.yml used by the project and inspect the cosmos-emulator service configuration, especially its environment and volume settings. Run the compose command on the default setup and verify that the Cosmos DB emulator becomes healthy and db-migrate completes without timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.