gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 09:16:57 25 4
gpt4 key购买 nike

我正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com