Linux Diagnostic

Fix "bash: sudo: command not found" in Docker & Minimal Linux

Minimal Linux distributions (such as official Debian/Ubuntu Docker images) omit the sudo package to keep image footprint small. The shell cannot find the binary in $PATH.

bash: sudo: command not found (Debian/Ubuntu/Docker)

Quick Fix Checklist

  1. In Docker containers: You are already root! Just run the command without sudo: apt-get update
  2. To install sudo on Debian/Ubuntu: apt-get update && apt-get install -y sudo
  3. On Alpine Linux: apk add --no-cache sudo (or use doas)