Project

General

Profile

Setup Docker in Ubuntu » History » Version 3

Gareth Eaton, 08/03/2023 10:17 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
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
24
</pre>
25
26
27 3 Gareth Eaton
Add the Docker repository:
28
29
For x86_64/amd64 architecture:
30
31
bash
32
Copy code
33
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
34
For arm64 architecture:
35
36
bash
37
Copy code
38
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
39
40
41
42 1 Gareth Eaton
Install Docker:
43
44
45
<pre>
46
sudo apt update
47
sudo apt install -y docker-ce docker-ce-cli containerd.io
48
</pre>
49
50
51
Start and Enable Docker:
52
53
<pre>
54
sudo systemctl start docker
55
sudo systemctl enable docker
56
</pre>
57
58
59
Verify Docker Installation:
60
61
<pre>
62
sudo docker --version
63
sudo docker info
64
</pre>
65
66
Run a Test Container:
67
68
<pre>
69
sudo docker run hello-world
70
</pre>