-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_docker_engine.sh
More file actions
executable file
·38 lines (31 loc) · 1.26 KB
/
install_docker_engine.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.26 KB
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
#!/bin/bash
#
# This script installs the Docker engine.
#
# Alternatively, you could choose to install Docker Desktop instead (see the
# install_docker_desktop.sh file).
#
# Prefer to install the Docker engine.
# Do not install both!
#
if [[ "$BASE_FOLDER" == '' ]]; then
BASE_FOLDER=~/mydata/projects/private/shell-tools/setup_linux_box
fi
# Add Docker's official GPG key
sudo apt update
sudo install -m 0755 -d /etc/apt/keyrings
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
# Add the 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 "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
#Install the Docker packages
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Start and setup docker service
echo "Start and setup docker service, add user '$USER' to group 'docker'"
$BASE_FOLDER/setup_docker.sh
# Verify that the installation is successful by running the hello-world image as non-root user
docker run hello-world