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:
"https://desktop.docker.com/linux/main/<arch>/docker-desktop-<docker_version>-<arch>.deb"
I need some help to get the latest version number of Docker Desktop.
An approach can be this: getting latest package url from 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 https://raw.githubusercontent.com/docker/docs/main/content/desktop/release-notes.md \
| awk '/^## / {print $2}' \
| head -n1
Current output:
4.22.1
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