If you’re working with containers and want to streamline application development and deployment, Docker is one of the most popular platforms to consider. It allows you to package applications into containers that are portable, lightweight, and easy to manage. For those using Ubuntu, Docker can be installed and set up quickly and efficiently.
In this article, we’ll walk you through the steps on how to install Docker on Ubuntu and get your Docker environment up and running smoothly. Whether you’re a beginner or experienced user, this guide will ensure a hassle-free installation process.
What is Docker?

Docker is an open-source platform used to automate the deployment, scaling, and management of applications. By using containers, Docker ensures that applications run consistently across different computing environments. Containers are isolated from each other and the host system, offering benefits like portability, flexibility, and security.
If you’re on Ubuntu, Docker allows you to easily build, deploy, and manage applications, making it an essential tool for developers, DevOps teams, and system administrators.
Requirements to Install Docker on Ubuntu
Before diving into the installation process, ensure you meet the following prerequisites:
- You have Ubuntu 18.04 or later installed.
- You have sudo privileges on your Ubuntu machine (or root access).
- You are connected to the internet.
Step-by-Step Guide: How to Install Docker on Ubuntu
Here is a step-by-step guide to help you install Docker on Ubuntu:
Step 1: Update Your System
Before installing Docker, it’s always good practice to ensure that your system is up to date. Open a terminal window and run the following commands:
sudo apt update
sudo apt upgrade
This will update all existing packages to their latest versions, ensuring there are no compatibility issues with the Docker installation.
Step 2: Install Required Dependencies
Docker installation requires a few dependencies, including apt-transport-https
, ca-certificates
, and curl
. Run the following command to install these packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add Docker’s Official GPG Key
Docker’s official repository is signed with a GPG key to verify the integrity of the software packages. To add the GPG key, run:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Step 4: Add Docker Repository
Now, you need to add Docker’s official repository to your system’s package sources list. This will allow you to install Docker directly from the Docker repository. Run the following command:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
The $(lsb_release -cs)
command automatically fetches the name of your Ubuntu release (like bionic or focal) and inserts it into the repository URL.
Step 5: Update Package Index Again
After adding Docker’s repository, update the package index to include Docker’s latest packages:
sudo apt update
Step 6: Install Docker
Now that everything is set up, you can finally install Docker by running the following command:
sudo apt install docker-ce
This command will install Docker Community Edition (CE), which is the free version of Docker. During the installation, Ubuntu will pull in the latest Docker package from the official repository.
Step 7: Verify Docker Installation
After Docker is installed, you can verify the installation by checking the version:
docker --version
You should see an output similar to this:
Docker version 20.10.6, build 370c289
This confirms that Docker has been successfully installed on your Ubuntu system.
Step 8: Start Docker Service
Docker usually starts automatically after installation, but you can manually start the Docker service by running:
sudo systemctl start docker
You can also enable Docker to start automatically when your system boots up with the following command:
sudo systemctl enable docker
Step 9: Test Docker Installation
To ensure that Docker is running correctly, you can run the hello-world container, which is a simple test that confirms Docker is installed and running. Execute the following command:
sudo docker run hello-world
If everything is set up correctly, you’ll see a message indicating that Docker is installed and functioning properly.
Step 10: Run Docker Without Sudo (Optional)
By default, Docker commands require sudo privileges. If you want to run Docker commands without typing sudo
every time, you can add your user to the docker group:
sudo usermod -aG docker $USER
After running this command, log out and log back in, or restart your system to apply the changes. You can now run Docker commands without using sudo
.
Troubleshooting Common Issues
- Docker not starting: If Docker doesn’t start after installation, check the status of the Docker service using:bashCopy
sudo systemctl status docker
- Permission Denied Errors: If you encounter errors related to permissions, it’s likely that your user is not in the Docker group. Ensure that you’ve followed the steps to add your user to the Docker group.
- Outdated Docker Versions: If you’re not getting the latest version of Docker, make sure that you’ve correctly added the Docker repository and updated your package list.
Conclusion
Congratulations! You’ve successfully learned how to install Docker on Ubuntu. Docker is an essential tool for managing containers, and with this installation guide, you now have it running on your Ubuntu machine. Whether you’re a developer, a system administrator, or simply someone exploring containerization, Docker will undoubtedly enhance your workflow.
Now that you’ve set up Docker, you can start exploring Docker containers, creating images, and even setting up Docker Compose to manage multi-container applications. Enjoy the power of Docker on your Ubuntu system!
READ MORE :- ChatGPT vs DeepSeek: A Detailed Comparison of two AI platforms
READ MORE :- How to Install Realtek Audio Driver for Windows 10
READ MORE :- 2025 AI Tools for Teachers: Enhance Your Classroom