代码之家  ›  专栏  ›  技术社区  ›  noblerare

如何在Azure Web Apps for containers中与Docker Linux容器共享驱动器?

  •  0
  • noblerare  · 技术社区  · 6 年前

    我正在将Linux容器部署到用于容器的Azure Web应用程序中,并在执行此操作时获取错误:

    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)
    

    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中做到这一点。任何帮助都将不胜感激。

    0 回复  |  直到 6 年前
        1
  •  2
  •   DashleenBhandari-MSFT    6 年前

    看起来这是一个外部存储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

    推荐文章