If you just want Docker running quickly on Ubuntu for dev, a lab box, or a small server, the shortest path is usually to use the package already available in Ubuntu's repository:
sudo apt install docker.io- add your user to the
dockergroup - test with
docker run hello-world
This guide follows exactly that flow.
When is docker.io enough?
On many Ubuntu machines, you do not need to add Docker's separate repository on day one.
If your goal is:
- quick setup
- fewer steps
- a working Docker runtime right away
- no strict need for the newest Docker release
then docker.io is often enough.
What should work at the end?
After this guide, you should be able to:
- run
docker --version - run Docker without
sudo - pass
docker run hello-world
If your Ubuntu package set already includes Compose support, you can also check docker compose version, but that is not the core requirement for the quick-install path here.
Step 1: Install Docker from the Ubuntu repository
sudo apt update
sudo apt install docker.io -y
Check the service:
sudo systemctl status docker
If Docker is not running yet:
sudo systemctl start docker
sudo systemctl enable docker
Step 2: Check the version
docker --version
If you get a permission denied error here, that is expected if your current user has not been added to the docker group yet.
Step 3: Add your user to the docker group
This is the step many people forget:
sudo usermod -aG docker $USER
Then log out and back in, or open a new shell with:
newgrp docker
The docker group grants high privileges on the machine, so only add users you trust.
Step 4: Test with hello-world
docker run hello-world
If everything is working, Docker will pull the hello-world image, run the container, print a confirmation message, and exit.
This is the fastest basic check that confirms:
- the Docker daemon is running
- your user can call Docker
- the machine can pull images normally
Full command block for a quick copy-and-run setup
sudo apt update
sudo apt install docker.io -y
sudo usermod -aG docker $USER
newgrp docker
docker --version
docker run hello-world
Common problems
1. Docker still says permission denied
Usually this means:
- you did not run
sudo usermod -aG docker $USER - you ran it but did not log out and back in
- your current shell has not picked up the new group yet
Try again:
newgrp docker
docker run hello-world
2. Docker is installed but not running
Just start and enable the service:
sudo systemctl start docker
sudo systemctl enable docker
When should you use Docker's official repository instead of docker.io?
You may want Docker's official repository if you need:
- a newer Docker version than Ubuntu ships
- the Compose plugin in the exact Docker-documented flow
- a setup closer to Docker's official documentation
If you do not need that yet, docker.io is usually the shortest path.
Conclusion
If your goal is a quick Docker install on Ubuntu, the shortest practical flow is:
sudo apt install docker.iosudo usermod -aG docker $USERdocker run hello-world
For many Ubuntu machines, those 3 steps are already enough to get started with containers.