How to Install Docker on Ubuntu: A Comprehensive Guide
Docker is a powerful platform that simplifies the development, shipping, and deployment of applications by using containerization. If you’re using Ubuntu and want to set up Docker, this guide will walk you through the process step-by-step.
Step 1: Update Your System
Before installing Docker, make sure your Ubuntu system is up-to-date. Open your terminal and run:
1 | sudo apt update |
Step 2: Install Required Packages
Install necessary packages to allow apt
to use packages over HTTPS:
1 | sudo apt install apt-transport-https ca-certificates curl software-properties-common |
Step 3: Add Docker’s Official GPG Key
Add Docker’s official GPG key to your system:
1 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
Step 4: Set Up the Docker Repository
Add Docker’s APT repository to your system:
1 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
Step 5: Install Docker
Update your package index and install Docker:
1 | sudo apt update |
Step 6: Start and Enable Docker
Start Docker and ensure it starts on boot:
1 | sudo systemctl start docker |
Step 7: Verify Docker Installation
Check if Docker is installed and running correctly by executing:
1 | sudo docker --version |
You should see Docker’s version information. To test Docker’s functionality, run:
1 | sudo docker run hello-world |
Conclusion
Congratulations! Docker is now installed on your Ubuntu system. You can start using it to build and manage containers. For more advanced Docker configurations and usage, check out Docker’s official documentation.