forked from cortensor/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-docker-ubuntu.sh
executable file
·42 lines (33 loc) · 1.61 KB
/
install-docker-ubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# This script installs Docker on Ubuntu systems.
# https://docs.docker.com/engine/install/ubuntu/
# Navigate to the directory where the script resides
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd $DIR
echo "Starting Docker installation process for Ubuntu..."
echo "==================================================="
echo "1. Updating package lists and installing prerequisites"
# Update and install required packages
sudo apt-get update -y
sudo apt-get install ca-certificates curl -y
echo " - Package lists updated and prerequisites installed"
echo "2. Setting up Docker GPG key and repository"
# Create a directory for Docker's GPG key
sudo install -m 0755 -d /etc/apt/keyrings
# Download and add Docker's GPG key
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo " - Docker GPG key added"
# Add the Docker repository to APT sources
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
echo " - Docker repository added to APT sources"
echo "3. Installing Docker components"
# Update APT and install Docker components
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
echo " - Docker components installed successfully"
echo "==================================================="
echo "Docker installation process completed successfully!"