-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker.bash
More file actions
executable file
·23 lines (16 loc) · 831 Bytes
/
Copy pathdocker.bash
File metadata and controls
executable file
·23 lines (16 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
if ! command -v docker &> /dev/null; then
sudo apt-get install ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo docker run hello-world
sudo groupadd docker
sudo usermod -aG docker $USER
echo
echo "Now re-login / restart the pc; Otherwise docker will not work with non-root users."
else
echo "Docker is already installed."
fi