Proof coverage 8/8 blocks
Code block 1 — verified · images:debian/13 · 15 Oct 2026 Code block 2 — verified · images:debian/13 · 15 Oct 2026 Code block 3 — verified · images:debian/13 · 15 Oct 2026 Code block 4 — verified · images:debian/13 · 15 Oct 2026 Code block 5 — verified · images:debian/13 · 15 Oct 2026 Code block 6 — verified · images:debian/13 · 15 Oct 2026 Code block 7 — verified · images:debian/13 · 15 Oct 2026 Code block 8 — verified · images:debian/13 · 15 Oct 2026On this page
Installing Docker from the Official Script on Debian/Ubuntu
This guide walks you through installing the latest stable version of Docker Engine using the official convenience script provided by Docker, and then adding your user to the docker group so you can run Docker commands without sudo.
Warning
The official convenience script is designed for testing and development environments. It installs dependencies, adds Docker’s GPG key and repository, configures the Docker daemon, and starts the service. Review the script before running it. For production systems, use the repository-based installation method instead.
Prerequisites
- A Debian- or Ubuntu-based distribution (e.g., Ubuntu 20.04+, Debian 11+).
- A user account with
sudoprivileges. - Internet access.
Step 1 – Download and Run the Docker Installation Script
Open a terminal. A fresh Debian or Ubuntu install doesn't include curl, so install it first, then download the script:
sudo apt-get update
sudo apt-get install -y curl
curl -fsSL https://get.docker.com -o get-docker.sh
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
If you prefer wget, install it the same way and use wget -qO get-docker.sh https://get.docker.com instead.
(Optional) Review the script before running it, for example with less get-docker.sh.
Run the script with sudo:
sudo sh get-docker.sh
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
The script will:
- Detect your distribution and version.
- Add Docker’s official APT repository.
- Install Docker Engine, CLI, containerd, and Docker Compose (v2 plugin).
- Start and enable the Docker service.
Once the script finishes, verify that Docker is installed and running:
sudo docker version
sudo docker info
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
These commands should display version information and system details.
Step 2 – Add Your User to the Docker Group
By default, docker commands require sudo. To allow your user to run Docker without sudo, add your user to the docker group:
sudo usermod -aG docker $USER
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
$USER automatically expands to your current username.
Apply the group change: log out and back in. To avoid logging out you can instead start a new shell with the group applied (newgrp docker) or a fresh login session (su - $USER). On a desktop environment, logging out and back in is simplest.
Then verify that you can run Docker commands without sudo:
docker run hello-world
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
If everything is set up correctly, you will see a welcome message from Docker.
Step 3 – (Optional) Manage Docker as a Non-Root User
After adding your user to the docker group, you can run all docker commands without sudo. However, be aware of the security implications: users in the docker group have effective root access. Only add trusted users to this group.
To check which users belong to the docker group:
getent group docker
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
Step 4 – Clean Up (Optional)
The downloaded script file can be removed:
rm get-docker.sh
Proven
- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
Troubleshooting
-
“Permission denied” when running
dockercommands – Ensure your user is in thedockergroup and you have started a new session after the group modification. -
Script fails with “unsupported distribution” – The official script only supports certain versions of Debian and Ubuntu. Check Docker’s documentation for supported distributions.
-
Docker service not running – Start it manually:
bashsudo systemctl start docker sudo systemctl enable dockerProven
Proof of run- status
- ✓ Verified
- env
- images:debian/13 · virtual-machine
- signal
- exit 0
- checked
- 15 Oct 2026
sha256 74e375dcf27d · matches the published textThis proof supports the code shown above.
Uninstalling Docker
If you ever need to remove Docker installed via the script, see the official uninstallation guide for Debian/Ubuntu.
Summary
- Install
curl, then download and run the official script withsudo sh get-docker.sh. - Add your user to the
dockergroup withsudo usermod -aG docker $USER. - Log out and back in (or use
newgrp docker) to apply group membership. - Verify with
docker run hello-world.
This method gives you a quick Docker setup on Debian/Ubuntu. For production environments, consider the repository-based installation to have more control over updates and dependencies.