【问题标题】:How to share drives with Docker Linux containers in Azure Web Apps for Containers?如何在 Azure Web Apps for Containers 中与 Docker Linux 容器共享驱动器?
【发布时间】:2019-05-22 20:15:42
【问题描述】:

我正在将 Linux 容器部署到 Azure Web Apps for Containers 并在执行此操作时遇到错误:

2019-05-22T18:33:20.506771506Z       Unable to start Kestrel.
2019-05-22T18:33:20.506777506Z Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file
2019-05-22T18:33:20.520011951Z    at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
2019-05-22T18:33:20.520078751Z    at Internal.Cryptography.Pal.CertificatePal.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
2019-05-22T18:33:20.536820007Z    at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
2019-05-22T18:33:20.536851707Z    at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
2019-05-22T18:33:20.536857407Z    at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadCertificate(CertificateConfig certInfo, String endpointName)
2019-05-22T18:33:20.536862107Z    at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadDefaultCert(ConfigurationReader configReader)
2019-05-22T18:33:20.536866907Z    at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()
2019-05-22T18:33:20.536871307Z    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.ValidateOptions()
2019-05-22T18:33:20.536884408Z    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)

docker-compose.yml

version: '3.4'

services:
  myservice:
    image: myimage:latest-tag
    ports:
      - "5555"
    environment:
      - ASPNETCORE_URLS=https://+:443
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/etc/ssl/certs/certificate.pfx
      - ASPNETCORE_Kestrel__Certificates__Default__Password=mypassword
    volumes:
      - C:\path\to\certs:/etc/ssl/certs

networks:
  default:
    external:
      name: nat

我为容器实例创建了一个新的 Web 应用程序,使用上面的 docker-compose.yml 文件设置它并得到上面的错误。我之前在我的开发环境中尝试docker run 应用程序时看到过这个错误。这与 Docker 试图访问我计算机上的共享驱动器有关。 Docker Desktop 会提示我并询问我是否要共享该驱动器并输入登录凭据。

但是,我不知道如何在 Azure 中执行此操作。任何帮助将不胜感激。

【问题讨论】:

    标签: azure docker azure-devops azure-web-app-service


    【解决方案1】:

    看起来这是一个外部存储 C:\path\to\certs,这是容器内的路径 - /etc/ssl/certs。但是,C:\path\to\certs 在我们的工作器上不存在,因为它是 Linux 机器并且 C:\ 不会退出。因此,如果您想映射我们提供的持久存储,我们必须使用 ${WEBAPP_STORAGE_HOME}。参考-https://docs.microsoft.com/en-us/azure/app-service/containers/configure-custom-container#use-persistent-storage-in-docker-compose

    【讨论】:

    • 这对我有帮助。谢谢。
    猜你喜欢
    • 2020-08-25
    • 1970-01-01
    • 2018-10-10
    • 2020-12-06
    • 1970-01-01
    • 2020-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多