0

I have followed the tutorial listed in Azure's official documentation. Automate VM Deployment

Here are the steps I followed in Azure's official tutorial.

  1. Creating a yaml file below
## Install packages on first boot
package_upgrade: true
packages:
  - docker
  - nodejs
  - python3.9
  1. Pasting the contents of cloud-config in the cloud init when I create a Ubuntu instance.

When I tried checking the Python version, it was still Python3.8 and also I could not invoke docker. When I checked the /var/log/cloud-init.log, docker has been successfully installed.

Log of 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
Ah Lag
  • 91
  • 1
  • 12

1 Answers1

1
  • It was still Python3.8

How did you invoke python? Installing python3.9 won't replace the system libraries or python. So python3 will still point to python3.8, but you should be able to invoke python3.9 with python3.9.

  • I could not invoke docker

I think you intended to install docker.io, not docker. docker in the repos is a system tray docking application.

falcojr
  • 1,299
  • 1
  • 10
  • 18
  • I have successfully installed docker with docker.io. – Ah Lag Dec 17 '21 at 13:01
  • Thank you so much! I was able to install python3.9 and invoked it with runcmd. What is the difference of installing packages with runcmd and packages? https://gist.github.com/ahlag/293287b4ba1711657455e17e9a97b9e2 – Ah Lag Dec 17 '21 at 13:10
  • I have also found a way to install docker from an APT source. What is the best practice of installing packages? [Reference] https://stackoverflow.com/questions/24418815/how-do-i-install-docker-using-cloud-init – Ah Lag Dec 17 '21 at 13:15