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
- In Docker containers: You are already root! Just run the command without sudo: apt-get update
- To install sudo on Debian/Ubuntu: apt-get update && apt-get install -y sudo
- On Alpine Linux: apk add --no-cache sudo (or use doas)