How to Install Docker on Ubuntu (Step-by-Step Guide)
Docker is a powerful containerization platform that simplifies application deployment. If you're looking to install Docker on your Ubuntu machine, follow this step-by-step guide.
Step 1: Update Ubuntu System
Open your terminal using Ctrl + Alt + T and update your system packages by running:
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Dependencies
Before installing Docker, install the necessary packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
Step 3: Add Docker’s GPG Key & Repository
To ensure package authenticity, add Docker’s GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Then, add the official 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
Update the package list:
sudo apt update
Install Docker Engine:
sudo apt install docker-ce docker-ce-cli containerd.io -y
Verify the installation:
docker --version
You should see an output similar to:
Docker version 24.0.5, build 123abcxyz
Step 5: Start & Enable Docker
Start the Docker service:
sudo systemctl start docker
Enable Docker to start on boot:
sudo systemctl enable docker
Check Docker’s status:
sudo systemctl status docker
If it's running successfully, you’ll see an Active (running) status.
Step 6: Run Docker Without Sudo (Optional)
To allow running Docker without sudo, add your user to the Docker group:
sudo usermod -aG docker $USER
Apply the changes by logging out and back in, or run:
newgrp docker
Verify by running:
docker ps
Step 7: Test Docker Installation
Ensure Docker is working correctly by running:
docker run hello-world
If successful, you’ll see:
Hello from Docker!
This message shows that your installation appears to be working correctly.
Conclusion
Congratulations! You’ve successfully installed Docker on your Ubuntu machine. Now you can start running containers and exploring Docker for your projects.
?? Watch the full step-by-step video tutorial on my YouTube channel: AAA Tech
If this guide helped you, feel free to like, comment, and share! ??
Information Systems undergraduate @ Singapore Management University | TF LEaRN Scholar
1 周Thanks for the article, Abdullah