我确实有一个运行 .net core 2 应用程序的 Docker 容器。
使用此代码配置日志记录 Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
})
.UseStartup<Startup>();
Run Code Online (Sandbox Code Playgroud)
和appsettings.json
文件
{
"Logging": {
"LogLevel": {
"Default": "Information"
}
},
}
Run Code Online (Sandbox Code Playgroud)
日志好像还可以,直接运行Kestrel的时候,可以在终端看到日志。同样的事情,当容器化时:命令docker logs
显示了我想要的。
在 Azure Web App 中作为容器运行时,生产中会出现问题。我找不到任何一致的 docker 日志。
我尝试通过 FTP 或通过 urlhttps://[mysite].scm.azurewebsites.net/api/logs/docker
访问日志文件,例如,日志文件几乎为空
https://[mysite].scm.azurewebsites.net/api/vfs/LogFiles/2018_09_09_RD0003FF74F63E_docker.log
,仅存在容器起始行
此外,我在通常的门户界面中也有相同的行。
问题是:Azure Web App 的 docker.log 文件中会自动输出 docker 日志吗?有什么我想念的吗?
c# azure docker azure-web-app-service azure-web-app-for-containers
我有一个与应用服务一起运行的多容器应用程序 - 用于容器的 Web 应用程序。只要在“容器设置”选项卡下提供 Docker Compose(预览)配置,一切都可以正常工作。
目前,我正在使用 Azure DevOps 为特定容器创建构建,然后使用容器设置下的持续部署选项(在 Azure 门户中)从 ACR 中提取最新部署的容器映像。这也很好用。我可以为单个容器运行构建,并且只部署特定的容器而不影响 Web 应用程序。(每个容器都是一个独立的项目,只有一个Dockerfile,不需要docker-compose)
但是,当我使用Azure App Service Deploy(版本 4.*)从 Azure DevOp 创建一个 Release 时,Azure 门户中的 Docker Compose(预览)配置被完全清除,它默认为单个容器并且应用程序中断。需要 Docker Compose 配置,因为它使主容器知道其他容器。
我使用的是 Azure 应用服务部署的 4.* 版。我想使用 Azure DevOps 的发布功能,因为它提供了更多的控制。
有没有一种方法可以从Azure 应用服务部署版本 4 中指定 docker-compose 多容器配置,以便应用服务知道多容器配置,而不是清除 Docker Compose 中的多容器配置(预览版)
谢谢,卡兰
azure-web-app-service azure-devops azure-web-app-for-containers
我们在Azure WebApp for Containers上的Docker中运行Java Spring Boot应用程序.单个B1实例足以让应用程序运行,但Spring Boot在启动时非常慢,并且可能需要240秒才能启动应用程序.
结果Azure WebApp for Containers在240秒后杀死容器,没有给它足够的时间来启动.
有没有办法更改默认的240秒启动超时?
docker spring-boot azure-web-app-service azure-web-app-for-containers
我正在创建基于 Docker 映像的 Azure AppService。该图像位于 Docker 公共注册表中,因此我希望该服务“知道”何时有新版本的图像(相同标签)。
我认为持续部署下的 WebHook 是为了实现这一点,但是当我用 curl 调用它时,我从主题中得到了消息。
我找不到合适的文档...是我认为(希望)的 WebHook URL 吗?是否有特定的 HTTP 动词可以使用?
编辑:我的意思是在 Azure 的容器设置中的持续部署下找到的 WebHook URL
我有一个用于运行 linux 的容器的 Web 应用程序。我正在运行一个 docker 容器。一切正常,但我想添加一个环境变量,如下所示:
docker run -e my_app_setting_var=theValue
Run Code Online (Sandbox Code Playgroud)
文档说应用程序设置将在此处自动添加为 -e 环境变量: 应用程序设置在运行时作为环境变量注入到您的应用程序中
但正如你从我的日志中看到的那样,它没有被添加:(一些东西被删除了)
docker run -d -p 30174:5000 --name thename -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5000 -e WEBSITE_SITE_NAME=the_website_name -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=the_role_id -e HTTP_LOGGING_ENABLED=1 acr_where_image_is.azurecr.io/image_name:latest Dockerfile
Run Code Online (Sandbox Code Playgroud)
我希望看到这样的环境变量:
docker run -d -p 30174:5000 --name thename -e my_app_setting_var=theValue
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
干杯
我目前正在尝试设置一个用于容器的 Azure Web 应用程序,将其链接到位于不同订阅内的 Azure 容器注册表。这就是为什么我最初的想法是使用Private Registry
Web 应用程序内的选项卡Container Settings
来输入所述注册表的凭据。
但是,当我保存并重新加载页面时,Azure Container Registry
选项卡的设置现在已填充,并且Private Registry
选项卡为空。问题是,我现在收到以下错误:
2020-01-21 21:51:12.951 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for cliswebapi, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}
我认为是因为没有存储密码。我该如何正确配置?
azure docker azure-container-registry azure-web-app-for-containers
使用自定义映像(来自 Centos 7 基础映像)部署了适用于容器的 Azure 应用服务。基于以下文档有一个环境变量应由 Azure 设置并用于创建 REST API 请求以获取访问令牌:
但是,在检查容器内部时,未设置此变量:
[root@f22dfd74be31 ~]# echo $IDENTITY_ENDPOINT
(empty result here)
Run Code Online (Sandbox Code Playgroud)
我还尝试调用 az cli,但也失败了:
[root@f22dfd74be31 ~]# az login -i
AzureConnectionError: Failed to connect to MSI. Please make sure MSI is configured correctly
and check the network connection.
Error detail: HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with
url: /metadata/identity/oauth2/token?resource=https%3
A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01 (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9e0c4
c72e8>: Failed to establish a new connection: [Errno 110] Connection timed out',)) …
Run Code Online (Sandbox Code Playgroud) azure azure-web-app-service azure-web-app-for-containers azure-appservice
Web Services 定期出现错误日志:
错误 - 站点 YYY 的容器 XXX 未在预期时间限制内启动。经过的时间 = 230.3790706 秒
我设置了微软博客中已经提到的以下设置,但仍然失败:
1. Use the EXPOSE instruction in your Dockerfile to expose port 3000.
2. Use the WEBSITES_PORT app setting with a value of "3000" to expose that port.
Run Code Online (Sandbox Code Playgroud)
如何配置来防止此错误?
web-services timeout azure azure-web-app-service azure-web-app-for-containers
azure-web-app-for-containers ×8
azure ×5
docker ×4
azure-devops ×2
c# ×1
containers ×1
spring-boot ×1
timeout ×1
web-services ×1