Project

General

Profile

Setup Docker in Ubuntu » History » Revision 4

Revision 3 (Gareth Eaton, 08/03/2023 10:17 PM) → Revision 4/8 (Gareth Eaton, 08/03/2023 10:17 PM)

h1. Setup Docker in Ubuntu 

 Set up an Ununtu server - we will use 22.10 


 Update Package Index: 

 <pre> 
 sudo apt update && apt upgrade 
 </pre> 

 Install Prerequisites: 

 <pre> 
 sudo apt install -y apt-transport-https ca-certificates curl software-properties-common 
 </pre> 

 Add Docker Repository: 

 Your might have to install curl - apt install curl 
 <pre> 
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 
 echo "deb [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 
 </pre> 


 Add the Docker repository: 

 For x86_64/amd64 architecture: 


 

 bash 
 Copy code 
 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 
 For arm64 architecture: 


 

 bash 
 Copy code 
 echo "deb [arch=arm64 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 



 Install Docker: 


 <pre> 
 sudo apt update 
 sudo apt install -y docker-ce docker-ce-cli containerd.io 
 </pre> 


 Start and Enable Docker: 

 <pre> 
 sudo systemctl start docker 
 sudo systemctl enable docker 
 </pre> 


 Verify Docker Installation: 

 <pre> 
 sudo docker --version 
 sudo docker info 
 </pre> 

 Run a Test Container: 

 <pre> 
 sudo docker run hello-world 
 </pre>