-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_docker.sh
31 lines (22 loc) · 1.02 KB
/
setup_docker.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
#!/bin/bash
# Update the package list
sudo apt-get update
# Install prerequisite packages
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker's official APT repository
echo \
"deb [arch=$(dpkg --print-architecture) 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
# Update the package list again
sudo apt-get update
# Install Docker Engine
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Start Docker and enable it to start on boot
sudo systemctl start docker
sudo systemctl enable docker
# Verify Docker installation
sudo docker --version
# Print a message indicating that the script has completed successfully
echo "Docker installation completed successfully!"