Docker Desktop install/upgrade script

I am using Ubuntu LTS version 22.04 . I am trying to automate the Docker Desktop install/upgrade process, and I stuck on getting latest version number of Docker Desktop. The download link for Ubuntu is in this format:
I need some help to get the latest version number of Docker Desktop.
An approach can be this: getting latest package url from Install Docker Desktop on Ubuntu | Docker Docs . But I don’t know how to do it.

I think parsing the release notes on GitHub would be easier:

curl -s \
  | awk '/^## / {print $2}' \
  | head -n1

Current output:


It works as long as Docker doesn’t add another title at the same level as version numbers. It would be a good idea to add a better regex to awk which validates filters only valid version numbers.

1 Like