Step 1: Update the System
sudo apt update
sudo apt upgrade -y
Step 2: Install Dependencies
Ensure that required dependencies are installed:
sudo apt install -y ca-certificates curl gnupg lsb-release
Step 3: Add Docker's Official GPG Key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Step 4: Set Up Docker Repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 5: Install Docker Engine
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 6: Start and Enable Docker
sudo systemctl start docker
sudo systemctl enable docker
Step 7: Verify Docker Installation
Run the following command to verify:
docker --version
Optional: Add Your User to the Docker Group
This allows you to run Docker without sudo.
sudo usermod -aG docker $USER
Log out and log back in to apply the group changes.
No comments:
Post a Comment