How to install Docker on Ubuntu 22.04?
AnsweredInstalling Docker on a fresh Ubuntu 22.04 server comes down to two routes: the convenience script at get.docker.com, or adding Docker's apt repository by hand.
They differ in what they pin and what they leave you to maintain afterwards. Either way there are post-installation steps that decide whether the daemon is usable without sudo.
1 Answer
For a development machine, Docker's convenience script is quickest (Docker does not recommend it for production):
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Then, to avoid sudo, add your user to the docker group. Docker warns that this group grants root-level privileges to the user; rootless mode avoids that:
sudo usermod -aG docker $USER
newgrp docker
Verify with docker --version and docker run hello-world.
For a production server, use the apt repository method instead: by default the convenience script installs the latest release, which can bring unexpected major-version upgrades. Check our Docker Guide for the full walkthrough.
Your Answer
Sign in to answer with your account, or give a name to answer without one.
Shown with your answer. 2 to 50 letters, numbers or spaces; up to 10 answers an hour without an account.
Used AI to write this? That is fine — say so in your post, and run any command before you suggest it. Answers that are AI-generated without saying so, or that were never tested, may be removed. Forum policy