如何在Docker for Windows上运行Cosmos DB Emulator?

时间:2017-05-14 16:30:46

标签: azure docker azure-cosmosdb

我试图在Docker for Windows上运行Cosmos DB Emulator,但我没有运气。我在这里遵循命令:

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

具体做法是:

v

我从Docker收到各种错误,包括"无效的绑定挂载"。命令本身似乎不对,所以我尝试将md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i mominag/documentdb_emulator 更改为mominag/documentdb_emulator,但这没有用。 这是我第一次真正尝试使用Docker并没有帮助。

我还在GitHub上查看了以下内容,它看起来像是Microsoft文档中命令的来源。

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

更新 以下是我正在运行的命令以及返回的错误。

microsoft/azure-documentdb-emulator

如果我删除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:\> 目录已创建,但我仍然在docker run命令上遇到相同的错误。

1 个答案:

答案 0 :(得分:3)

根据你的描述,我通过电源shell检查了命令行,我发现目录没有正确创建,如下所示:

enter image description here

注意:您可以将%LOCALAPPDATA%替换为$env:LOCALAPPDATA

运行以下命令行以启动documentdb模拟器时:

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

我遇到以下错误:

enter image description here

当我将mominag/documentdb_emulator更改为microsoft/azure-documentdb-emulator时,我可以按如下方式成功启动documentdb模拟器:

enter image description here