
Docker is a popular containerization platform that simplifies application deployment by packaging applications and their dependencies into lightweight, portable containers. If you’re running an Ubuntu server, setting up Docker is straightforward. This guide will walk you through installing and configuring Docker on Ubuntu.
Step 1: Update System Packages
Before installing Docker, ensure your system is up to date:
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Dependencies
Install necessary packages to allow apt to use repositories over HTTPS:
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
Step 3: Add Docker’s Official GPG Key and Repository

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Now, add the Docker repository:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 4: Install Docker Engine
Update package lists and install Docker:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Step 5: Verify Docker Installation
Check if Docker is running:
sudo systemctl status docker
To verify the installation, run:
docker --version
Step 6: Manage Docker as a Non-Root User (Optional)
To run Docker commands without sudo
, add your user to the Docker group:
sudo usermod -aG docker $USER
Log out and back in for the changes to take effect.
Step 7: Test Docker Installation
Run a test container:
docker run hello-world
If the output confirms successful execution, Docker is installed and running correctly.
Step 8: Enable Docker to Start on Boot
Ensure Docker starts automatically after a reboot:
sudo systemctl enable docker
Conclusion
Installing Docker on an Ubuntu server is a simple process that enables you to leverage containerized applications efficiently. With Docker set up, you can start deploying and managing containers seamlessly.
Mastering Storage in Windows Server: Disks, Volumes, and RAID Explained (F.A.Q)
How do I uninstall Docker from Ubuntu?
Run:
sudo apt remove -y docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
How can I check if Docker is installed?
Run:
docker --version
If installed, this will return the Docker version.
How do I restart Docker?
Use:
sudo systemctl restart docker
Can I install Docker on Ubuntu without root access?
No, but you can add your user to the Docker group to run commands without sudo
:
sudo usermod -aG docker $USER