简体   繁体   中英

How do I run Cosmos DB Emulator on Docker for Windows?

I'm trying to get Cosmos DB Emulator running on Docker for Windows but I am not having any luck. I am following the commands here:

https://docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator

Specifically:

md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i mominag/documentdb_emulator

I am getting various errors from Docker including "invalid bind mount". The command itself doesn't seem right so I've tried changing mominag/documentdb_emulator to microsoft/azure-documentdb-emulator but that has not worked. It doesn't help that this is my first real attempt at using Docker.

I also took a look at the following on GitHub which looks like the source of the commands in the Microsoft docs.

https://github.com/Azure/azure-documentdb-emulator-docker

UPDATE: Here are the commands I am running and the errors that are returned.

PS C:\> md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
out-file : FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:',
call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.
At line:1 char:1
+ md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], NotSupportedException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

PS C:\> docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i docume
ntdb_emulator
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid bind mount spec "%LOCALAPPD
ATA%\\DocumentDBEmulatorCert:c:\\DocumentDBEmulator\\DocumentDBEmulatorCert": invalid volume specification: '%LOCALAPPDA
TA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert'.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
PS C:\>

If I remove the 2>nul the directory is created but I still get the same error on the docker run command.

According to your description, I have checked the command line via power shell, I found the directory is not created correctly as follows:

在此输入图像描述

Note: you could replace %LOCALAPPDATA% with $env:LOCALAPPDATA .

When running the following command line to start the documentdb emulator:

docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i mominag/documentdb_emulator

I encountered the following error:

在此输入图像描述

When I changing mominag/documentdb_emulator to microsoft/azure-documentdb-emulator , then I could start my documentdb emulator successfully as follows:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM