python - 在部署的 Azure 虚拟机启动时运行自定义脚本

标签 python linux azure docker

我正在使用 Azure Python SDK 在云中部署 Linux 虚拟机。该虚拟机具有公共(public) IP 并启用了 ssh。我需要让该虚拟机在启动后立即运行自定义脚本。该脚本将安装 pip、python、docker 等并启动 docker 容器。

部署虚拟机时如何传递此脚本?/如何指示虚拟机在启动后运行此脚本?

干杯, 史蒂夫

最佳答案

根据您的情况,您可以使用Azure Custom Script Extension .

The Custom Script Extension downloads and executes scripts on Azure virtual machines. This extension is useful for post deployment configuration, software installation, or any other configuration / management task. Scripts can be downloaded from Azure storage or other accessible internet location, or provided to the extension run time.

如果你想使用python来做这个,请引用这个python sdk documentation .

类似请引用question .

关于python - 在部署的 Azure 虚拟机启动时运行自定义脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46301655/

相关文章:

azure - 调用刷新 token 时 id_token 格式错误

python - 有向图中的最大公共(public)子图

python - pandas 每组特定值的频率

python - 从网页上抓取 2 个不同格式的表格 - Beautiful Soup

c - 全局按键监听器

mysql - 无法(重新)为 debian-sys-maint 设置权限,错误 1045 访问被拒绝

python - 比循环和调用循环调用另一个函数的函数更好的方法

php - 用于 PDF 缩小的 ImageMagick 替代方案

Azure AD B2C 与外部 Idp 和 SSO 集成到由外部 Idp 进行身份验证的应用程序

azure - 将 Azure Kubernetes 服务 (AKS) 附加到 Azure 容器注册表 (ACR),无需成为订阅所有者