-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallDockerInUbuntu.sh
More file actions
23 lines (18 loc) · 1.01 KB
/
installDockerInUbuntu.sh
File metadata and controls
23 lines (18 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin bash
# Update Docker installation steps for the latest Ubuntu release (24.04+)
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg lsb-release
# Configure Docker's official GPG key using the recommended keyring location
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the stable repository for the detected Ubuntu codename
echo \
"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
\"$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable docker
sudo usermod -aG docker "$(whoami)"
echo "Installation of Docker finished for the latest Ubuntu release."