我正在将Linux容器部署到用于容器的Azure Web Apps上,并在执行操作时出现错误:
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 App实例,使用上面的docker-compose.yml
文件进行了设置,并得到了上面的错误。在尝试在开发环境上docker run
应用程序之前,我已经看到此错误。这与Docker尝试访问我的计算机上的共享驱动器有关。 Docker Desktop会提示我,并询问我是否要共享该驱动器并输入登录凭据。
但是,我不知道如何在Azure中执行此操作。任何帮助将不胜感激。
答案 0 :(得分:2)
看起来这是一个外部存储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