【问题标题】:How do I upgrade python3.8 to python3.9 and install docker using cloud-init on Azure VM's ubuntu?如何在 Azure VM 的 ubuntu 上将 python3.8 升级到 python3.9 并使用 cloud-init 安装 docker?
【发布时间】:2022-01-14 22:06:13
【问题描述】:

我已按照 Azure 官方文档中列出的教程进行操作。 Automate VM Deployment

这是我在 Azure 官方教程中遵循的步骤。

  1. 在下面创建一个 yaml 文件
## Install packages on first boot
package_upgrade: true
packages:
  - docker
  - nodejs
  - python3.9
  1. 在创建 Ubuntu 实例时将 cloud-config 的内容粘贴到 cloud init 中。

当我尝试检查 Python 版本时,它仍然是 Python3.8,而且我无法调用 docker。当我查看/var/log/cloud-init.log时,docker已经安装成功了。

less /var/log/cloud-init.log的日志

2021-12-10 06:03:55,535 - subp.py[DEBUG]: Running command ['eatmydata', 'apt-get', '--option=Dpkg::Options::=--force-confold', '--option=Dpkg::options::=--force-unsafe-
io', '--assume-yes', '--quiet', 'install', 'docker'] with allowed return codes [0] (shell=False, capture=False)
2021-12-10 06:03:57,901 - util.py[DEBUG]: apt-install [eatmydata apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-ye
s --quiet install docker] took 2.365 seconds

【问题讨论】:

    标签: azure virtual-machine cloud-init


    【解决方案1】:
    • 还是 Python3.8

    你是如何调用 python 的?安装 python3.9 不会替换系统库或 python。所以python3 仍将指向python3.8,但您应该能够使用python3.9 调用python3.9。

    • 我无法调用 docker

    我认为您打算安装 docker.io,而不是 docker。 repos中的docker是一个系统托盘对接应用。

    【讨论】:

    猜你喜欢
    • 2019-07-21
    • 2014-08-16
    • 2021-11-03
    • 2019-05-17
    • 2015-09-15
    • 2022-09-29
    • 1970-01-01
    • 2021-05-24
    • 2020-12-16
    相关资源
    最近更新 更多