SmartDocs
Current page as Markdown (.md) Includes verification proof.
On 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 sudo privileges.
  • 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:

bash
sudo apt-get update
sudo apt-get install -y curl
curl -fsSL https://get.docker.com -o get-docker.sh
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 1a49b488c391 · matches the published text
This proof supports the code shown above.

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:

bash
sudo sh get-docker.sh
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 4058e9a0e2c5 · matches the published text
This proof supports the code shown above.

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:

bash
sudo docker version
sudo docker info
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 503469468a2e · matches the published text
This proof supports the code shown above.

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:

bash
sudo usermod -aG docker $USER
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 481624b01a54 · matches the published text
This proof supports the code shown above.

$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:

bash
docker run hello-world
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 b9bf01ae9434 · matches the published text
This proof supports the code shown above.

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:

bash
getent group docker
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 7763a32a99f6 · matches the published text
This proof supports the code shown above.

Step 4 – Clean Up (Optional)

The downloaded script file can be removed:

bash
rm get-docker.sh
Proven
Proof of run
status
✓ Verified
env
images:debian/13 · virtual-machine
signal
exit 0
checked
15 Oct 2026
sha256 e79a26c8bfa8 · matches the published text
This proof supports the code shown above.

Troubleshooting

  • “Permission denied” when running docker commands – Ensure your user is in the docker group 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:

    bash
    sudo systemctl start docker
    sudo systemctl enable docker
    
    Proven
    Proof of run
    status
    ✓ Verified
    env
    images:debian/13 · virtual-machine
    signal
    exit 0
    checked
    15 Oct 2026
    sha256 74e375dcf27d · matches the published text
    This 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 with sudo sh get-docker.sh.
  • Add your user to the docker group with sudo 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.