title: Failed to Connect to the Azure Cosmos DB Emulator running Docker using Mongo
body: <p>I'm having trouble using the Azure Cosmos Emulator running in Docker. When run my app, I get the following error while trying to connect to the DB: </p>
  
  <pre><code>connection error: MongoNetworkError: failed to connect to server [localhost:10255] on first connect [Error: connect ETIMEDOUT 127.0.0.1:10255
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14) {
    name: 'MongoNetworkError',
    [Symbol(mongoErrorContextSymbol)]: {}
  }]
  </code></pre>
  
  <h3>Setup</h3>
  
  <p>As per the <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#running-on-docker" rel="nofollow noreferrer">Running on Docker instructions</a>, I pulled the image and ran</p>
  
  <pre><code>md %LOCALAPPDATA%\CosmosDBEmulator\bind-mount
  
  docker run --name azure-cosmosdb-emulator --memory 2GB --mount "type=bind,source=%LOCALAPPDATA%\CosmosDBEmulator\bind-mount,destination=C:\CosmosDB.Emulator\bind-mount" --interactive --tty -p 8081:8081 -p 8900:8900 -p 8901:8901 -p 8902:8902 -p 10250:10250 -p 10251:10251 -p 10252:10252 -p 10253:10253 -p 10254:10254 -p 10255:10255 -p 10256:10256 -p 10350:10350 mcr.microsoft.com/cosmosdb/windows/azure-cosmos-emulator
  </code></pre>
  
  <h3>Config</h3>
  
  <ol>
  <li>I've tried several different connection strings with no luck, the main one I'm using is:</li>
  </ol>
  
  <pre><code>mongodb://localhost:C2y6yDjf5%2FR%2Bob0N8A7Cgv30VRDJIWEHLM%2B4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw%2FJw%3D%3D@localhost:10255/admin?ssl=true
  </code></pre>
  
  <ol start="2">
  <li><p>I am able to access the explorer on <a href="https://localhost:8081/_explorer/index.html" rel="nofollow noreferrer">https://localhost:8081/_explorer/index.html</a> so the emulator is running.</p></li>
  <li><p>I'm using mongoose in app</p></li>
  </ol>