2017-05-14 80 views
1

我试图让Docker for Windows上运行的Cosmos数据库模拟器,但我没有任何运气。我在这里以下命令:如何在Docker for Windows上运行Cosmos数据库模拟器?

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

具体做法是:

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

我从码头工人得到的各种错误,包括 “无效的绑定安装”。该命令本身似乎并不正确,所以我试图将mominag/documentdb_emulator更改为microsoft/azure-documentdb-emulator,但该功能无效。 这并不意味着这是我第一次尝试使用Docker。

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

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

UPDATE: 这里是我运行的命令和返回的错误。

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:\> 

如果我删除2>nul创建目录,但我还是坐上泊坞窗运行命令相同的错误。

+2

我刚刚做到了,它工作得很好。原始命令和'microsoft/azure-documentdb-emulator'都能正常工作,您是否将docker切换到Windows模式\容器? – 4c74356b41

+0

我没有切换到Windows容器,但我刚刚做了,但仍然出现错误。我将用特定的错误消息更新问题。 – user1843640

+0

我会建议删除所有的虚拟网络和安装docker从零开始 – 4c74356b41

回答

2

根据你的描述,我选中了通过电源外壳在命令行中,我发现如下目录建立不正确:

enter image description here

注:你可以用$env:LOCALAPPDATA取代%LOCALAPPDATA%

运行以下命令行何时开始documentdb模拟器:

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

我遇到下列错误:

enter image description here

当我改变mominag/documentdb_emulatormicrosoft/azure-documentdb-emulator,然后我可以开始我的documentdb模拟器成功如下:

enter image description here

+0

用$ env:LOCALAPPDATA替换%LOCALAPPDATA%在创建目录和执行“docker run”时做了窍门。谢谢。 – user1843640

相关问题