Project

General

Profile

Setup Docker in Ubuntu » History » Version 8

Gareth Eaton, 08/03/2023 10:23 PM

1 1 Gareth Eaton
h1. Setup Docker in Ubuntu
2
3
Set up an Ununtu server - we will use 22.10
4
5
6
Update Package Index:
7
8
<pre>
9
sudo apt update && apt upgrade
10
</pre>
11
12
Install Prerequisites:
13
14
<pre>
15
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
16
</pre>
17
18
Add Docker Repository:
19
20 2 Gareth Eaton
Your might have to install curl - apt install curl
21 1 Gareth Eaton
<pre>
22
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
23
</pre>
24
25
26 3 Gareth Eaton
Add the Docker repository:
27
28
For x86_64/amd64 architecture:
29 1 Gareth Eaton
30 6 Gareth Eaton
<pre>
31 1 Gareth Eaton
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
32 6 Gareth Eaton
</pre>
33 3 Gareth Eaton
34 1 Gareth Eaton
For arm64 architecture:
35 5 Gareth Eaton
36 6 Gareth Eaton
<pre>
37 3 Gareth Eaton
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
38 6 Gareth Eaton
</pre>
39 3 Gareth Eaton
40 1 Gareth Eaton
Install Docker:
41
42
43
<pre>
44
sudo apt update
45
sudo apt install -y docker-ce docker-ce-cli containerd.io
46
</pre>
47
48
49
Start and Enable Docker:
50
51
<pre>
52
sudo systemctl start docker
53 7 Gareth Eaton
</pre>
54
55
Run the following command to enable the Docker service to start on boot: 
56
57
<pre>
58 1 Gareth Eaton
sudo systemctl enable docker
59
</pre>
60
61 8 Gareth Eaton
You can verify that the Docker service is set to start on boot by running:
62
63
<pre>
64
sudo systemctl is-enabled docker
65
</pre>
66
67 1 Gareth Eaton
68
Verify Docker Installation:
69
70
<pre>
71
sudo docker --version
72
sudo docker info
73
</pre>
74
75
Run a Test Container:
76
77
<pre>
78
sudo docker run hello-world
79
</pre>