Skip to content

docs: fix binary download URLs to match release artifact naming#2129

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/fix-this-https-github-com-docker-docker-fb13d3a1
Mar 16, 2026
Merged

docs: fix binary download URLs to match release artifact naming#2129
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/fix-this-https-github-com-docker-docker-fb13d3a1

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 16, 2026

Problem

The installation guide's download script used $(uname -s)-$(uname -m) which produces OS/arch values like Linux-x86_64, but the release binaries use Go's GOOS-GOARCH convention (e.g. linux-amd64). This made the download command fail on Linux (and potentially other platforms).

Fix

  • Map uname -s to lowercase (Linuxlinux, Darwindarwin)
  • Map uname -m to Go arch names (x86_64amd64, aarch64arm64)
  • Fix Windows section to reference docker-agent-windows-amd64.exe (lowercase)

Fixes #2117

The install script used raw uname -s and uname -m values (e.g. Linux-x86_64), but release binaries use Go's GOOS-GOARCH convention (e.g. linux-amd64). Map uname output to the correct lowercase OS and architecture names.

Fixes docker#2117

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner March 16, 2026 16:38
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Assessment: 🟡 NEEDS ATTENTION

This PR successfully fixes the primary issue (OS/arch naming mismatch), but the installation script has three robustness issues that could affect users on edge-case platforms or during download failures.

Critical Finding

HIGH severity: The curl download lacks error handling, which could lead to installing a corrupted or non-existent binary with sudo privileges.

Additional Findings

MEDIUM severity:

  • Missing default case in architecture detection could produce confusing errors on unsupported platforms
  • No validation of OS/ARCH variables before URL construction

Recommendation

While these issues don't break the primary use cases (Linux/macOS on x86_64/aarch64), adding basic error handling and validation would significantly improve the user experience and security posture of the installation script.


Note: This is an automated review. All findings have been verified against the actual code changes.

# Download the latest release
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m); case "$ARCH" in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac
curl -L "https://github.com/docker/docker-agent/releases/latest/download/docker-agent-${OS}-${ARCH}" -o docker-agent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH: Missing error handling for curl download failure

The curl command has no error checking. If the download fails (network issue, 404 error, release not published), the script will continue executing chmod +x and sudo mv on a potentially non-existent or corrupted file.

Security risk: This could install a broken binary or, in a MITM attack scenario, blindly install malicious content with sudo privileges.

Recommendation: Add error handling:

curl -fL "https://github.com/docker/docker-agent/releases/latest/download/docker-agent-${OS}-${ARCH}" -o docker-agent || {
  echo "Error: Failed to download docker-agent for ${OS}-${ARCH}"
  exit 1
}
# Verify the file exists and has content
[ -s docker-agent ] || { echo "Error: Downloaded file is empty"; exit 1; }
chmod +x docker-agent
sudo mv docker-agent /usr/local/bin/

curl -L https://github.com/docker/docker-agent/releases/latest/download/docker-agent-$(uname -s)-$(uname -m) -o docker-agent
# Download the latest release
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m); case "$ARCH" in x86_64) ARCH=amd64;; aarch64) ARCH=arm64;; esac
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM: Missing default case in architecture detection

The case statement only handles x86_64 and aarch64, but doesn't have a default case for unsupported architectures. While macOS ARM returns arm64 (which works because it's already the correct Go arch name), other platforms might return unexpected values like i686, armv7l, etc.

Impact: Users on unsupported platforms will get a confusing 404 error instead of a clear "unsupported platform" message.

Recommendation: Add a default case:

ARCH=$(uname -m)
case "$ARCH" in
  x86_64) ARCH=amd64;;
  aarch64|arm64) ARCH=arm64;;
  *) echo "Error: Unsupported architecture: $ARCH"; exit 1;;
esac

# Download the latest release (adjust URL for your platform)
curl -L https://github.com/docker/docker-agent/releases/latest/download/docker-agent-$(uname -s)-$(uname -m) -o docker-agent
# Download the latest release
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM: No validation of OS and ARCH variables

The script directly uses OS and ARCH variables without validating they contain expected values. If uname -s returns an unsupported OS (e.g., FreeBSD, SunOS), the download URL will be malformed.

Impact: Users on unsupported platforms get a 404 error instead of a clear message about platform support.

Recommendation: Add validation after setting the variables:

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
  x86_64) ARCH=amd64;;
  aarch64|arm64) ARCH=arm64;;
  *) echo "Error: Unsupported architecture: $ARCH"; exit 1;;
esac

# Validate OS
case "$OS" in
  linux|darwin) ;;
  *) echo "Error: Unsupported OS: $OS (supported: linux, darwin)"; exit 1;;
esac

@dgageot dgageot merged commit 592da25 into docker:main Mar 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installation guide cannot download binaries on Ubuntu 24.04 (Linux)

2 participants