【问题标题】:Azure CosmosDB Emulator on Docker doesn't generate certificateDocker 上的 Azure CosmosDB 模拟器不生成证书
【发布时间】:2019-03-23 12:32:04
【问题描述】:

我正在尝试按照以下说明在 Docker 容器中运行 Azure CosmosDB 模拟器:

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#running-on-docker

描述的主要命令有:

md %LOCALAPPDATA%\CosmosDBEmulatorCert 2>null docker run -v %LOCALAPPDATA%\CosmosDBEmulatorCert:C:\CosmosDB.Emulator\CosmosDBEmulatorCert -P -t -i -m 2GB microsoft/azure-cosmosdb-emulator

下一条指令是在主机上导入 SSL 证书: cd /d %LOCALAPPDATA%\CosmosDBEmulatorCert powershell .\importcert.ps1

但文件夹是空的 - 没有证书,也没有 powershell 脚本。

同样,容器上的C:\CosmosDB.Emulator\CosmosDBEmulatorCert 文件夹也是空的。

当一切都在初始化时,有一行说:

-a---- 10/18/2018 4:50 PM 513 CosmosDbEmulatorCert.cer

但我在任何地方都看不到证书

【问题讨论】:

    标签: azure docker azure-cosmosdb


    【解决方案1】:

    URL 上的说明 - https://hub.docker.com/r/microsoft/azure-cosmosdb-emulator/ 工作正常。

    不过,我仍然想建议一些更改 -

    第 1 步:

    md cd $env:LOCALAPPDATA\CosmosDBEmulatorCert
    
    docker run --name azure-cosmosdb-emulator --memory 2GB -p 8081:8081 --mount "type=bind,source=$env:LOCALAPPDATA\CosmosDBEmulatorCert,destination=C:\CosmosDB.Emulator\bind-mount" -P --interactive --tty microsoft/azure-cosmosdb-emulator
    

    第二步:

    • 打开另一个 powershell 窗口并运行以下命令集

      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

      $env:LOCALAPPDATA\CosmosDBEmulatorCert\importcert.ps1

      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Restricted

    第三步:

    在 localhost 上的可访问性应该不会再收到证书错误

    【讨论】:

      【解决方案2】:

      请改用以下说明: https://hub.docker.com/r/microsoft/azure-cosmosdb-emulator/

      run 命令显示略有不同。它使用--mount 而不是-v 选项来处理卷和绑定:

      (将%hostDirectory% 替换为您要存储证书的路径,如C:\Users\<youruser>\AppData\Local\azure-cosmosdb-emulator-hostd 或在脚本中声明)

       docker run --name azure-cosmosdb-emulator --memory 2GB --mount "type=bind,source=%hostDirectory%,destination=C:\CosmosDB.Emulator\bind-mount" -P --interactive --tty microsoft/azure-cosmosdb-emulator
      

      然后您可以关闭交互式 shell。它将继续运行。

      【讨论】:

        【解决方案3】:

        我在C:\CosmosDB.Emulator\bind-mount的容器中找到了证书

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-09-11
          • 1970-01-01
          • 2012-08-19
          • 2022-10-05
          • 1970-01-01
          • 2019-08-29
          • 1970-01-01
          相关资源
          最近更新 更多