【Azure App Service for Linux】Linux Web App如何安装系统未安装的包

简介: 【Azure App Service for Linux】Linux Web App如何安装系统未安装的包

问题描述

Linux Web App中如何安装系统默认未安装的包,如何来执行如 apt install XXX命令呢?现在遇见的问题时,通过Azure App Service门户中的SSH登录后,执行命令Web端一侧长久没有响应。

 

根本原因

使用SSH连接到Linux web app的实例,可以参考博文(【应用服务 App Service】解决无法从Azure门户SSH登录问题)中描述的内容:使用 az webapp create-remote-connection 命令打开到应用的远程连接。

当本地网络情况好的情况下,直接在Web SSH上执行apt 等命令也是可以成功的。如下:

但是由于App Service的PaaS特性,实例会随时发生变化,所以如果通过这样的方式安装应用所需要的一些package,并不会持久化,也不会同步到其他实例上。当实例变动时或站点重启,均会丢失通过此方式安装的包(Package),所以建议把应用程序打包为镜像,使用容器化的方式部署到Azure App Service for Container。

 

解决方案

使用 az webapp config container set 命令指定要为 Web 应用部署的容器注册表和映像:

az webapp config container set --name <app-name> --resource-group AppSvc-DockerTutorial-rg --docker-custom-image-name <registry-name>.azurecr.io/appsvc-tutorial-custom-image:latest --docker-registry-server-url https://<registry-name>.azurecr.io

  • <app_name> 替换为 Web 应用的名称,并在两个位置将 <registry-name> 替换为注册表的名称。

 

部署镜像的命令查看Azure官方文档:https://docs.microsoft.com/zh-cn/azure/app-service/tutorial-custom-container?pivots=container-linux#deploy-the-image-and-test-the-app

相关文章
|
27天前
|
资源调度 JavaScript Linux
【Azure 应用服务】本地Node.js部署上云(Azure App Service for Linux)遇到的三个问题解决之道
【Azure 应用服务】本地Node.js部署上云(Azure App Service for Linux)遇到的三个问题解决之道
|
26天前
|
应用服务中间件 Linux 网络安全
【Azure 应用服务】App Service for Linux 环境中为Tomcat页面修改默认的Azure 404页面
【Azure 应用服务】App Service for Linux 环境中为Tomcat页面修改默认的Azure 404页面
|
26天前
|
存储 Linux 开发工具
【Azure App Service】本地Git部署Python Flask应用上云(Azure App Service For Linux)关键错误
【Azure App Service】本地Git部署Python Flask应用上云(Azure App Service For Linux)关键错误
|
27天前
|
JSON Linux 网络安全
【Azure 应用服务】如何从App Service for Linux 的环境中下载Container中非Home目录下的文件呢?
【Azure 应用服务】如何从App Service for Linux 的环境中下载Container中非Home目录下的文件呢?
|
26天前
|
存储 Linux 网络安全
【Azure App Service】.NET代码实验App Service应用中获取TLS/SSL 证书 (App Service Linux/Linux Container)
【Azure App Service】.NET代码实验App Service应用中获取TLS/SSL 证书 (App Service Linux/Linux Container)
|
26天前
|
JavaScript Linux
【Azure App Service for Linux】NodeJS镜像应用启动失败,遇见 RangeError: Incorrect locale information provided
【Azure App Service for Linux】NodeJS镜像应用启动失败,遇见 RangeError: Incorrect locale information provided
|
27天前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
|
27天前
|
Kubernetes Linux Docker
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
|
20天前
|
数据库 开发者 Python
web应用开发
【9月更文挑战第1天】web应用开发
34 1
|
8天前
|
数据可视化 图形学 UED
只需四步,轻松开发三维模型Web应用
为了让用户更方便地应用三维模型,阿里云DataV提供了一套完整的三维模型Web模型开发方案,包括三维模型托管、应用开发、交互开发、应用分发等完整功能。只需69.3元/年,就能体验三维模型Web应用开发功能!
32 8
只需四步,轻松开发三维模型Web应用