Skip to content

Instantly share code, notes, and snippets.

@mdesantis
Created April 29, 2026 14:55
Show Gist options
  • Select an option

  • Save mdesantis/184bc552522ac8c66b3773b8d349802c to your computer and use it in GitHub Desktop.

Select an option

Save mdesantis/184bc552522ac8c66b3773b8d349802c to your computer and use it in GitHub Desktop.
Auto-update Docker Desktop on Debian/Ubuntu: polls appcast.xml, downloads .deb, installs via apt
#!/usr/bin/env bash
set -euo pipefail
APPCAST_URL="https://desktop.docker.com/linux/main/amd64/appcast.xml"
DEB_TMP="/tmp/docker-desktop-amd64.deb"
installed=$(dpkg-query -W -f='${Version}' docker-desktop 2>/dev/null | grep -oP '^\d+\.\d+\.\d+' || true)
if [[ -z "$installed" ]]; then
echo "Docker Desktop not installed (dpkg-query found nothing)."
exit 1
fi
appcast=$(curl -fsSL "$APPCAST_URL")
latest=$(echo "$appcast" | grep -oP 'sparkle:shortVersionString="\K[^"]+')
build=$(echo "$appcast" | grep -oP 'sparkle:version="\K[^"]+')
deb_url=$(echo "$appcast" | grep -oP 'enclosure url="\K[^"]+')
echo "Installed : $installed"
echo "Latest : $latest (build $build)"
if [[ "$installed" == "$latest" ]]; then
echo "Up to date."
exit 0
fi
echo "Update available: $installed → $latest"
echo "Downloading..."
curl -L --progress-bar -o "$DEB_TMP" "$deb_url"
echo "Installing..."
sudo apt install -y "$DEB_TMP"
echo "Cleaning up..."
rm -f "$DEB_TMP"
echo "Done. Docker Desktop $latest installed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment