-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker_install.sh
executable file
·32 lines (24 loc) · 1.19 KB
/
docker_install.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
#! /bin/bash
# Install Docker Engine from Docker's apt repository.
echo "Let's start installing the Docker Engine!"
echo "Uninstall the old versions of Docker first."
sudo apt-get remove docker docker-engine docker-io containerd runc
# Configure the Repository
echo "Now start installing stages."
echo "Set up the repository"
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg lsb-release
echo "Add Docker's official GPG key"
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
echo "Use the following command to set up the repository."
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
echo "Install Docker Engine, containerd, and Docker Compose."
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "Verification with hello-world image."
sudo docker run hello-world