-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_docker_ubuntu.sh
33 lines (23 loc) · 1.19 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
#!/bin/bash
# Update the package list
sudo apt update
# Install dependencies to allow apt to use a repository over HTTPS
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
# Add the Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add the Docker repository
echo "deb [arch=amd64 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 after adding the Docker repository
sudo apt update
# Install Docker
sudo apt install -y docker-ce docker-ce-cli containerd.io
# Add your user to the docker group to avoid using sudo when running Docker
sudo usermod -aG docker $USER
# activate the changes to group
newgrp docker
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Test Docker and Docker Compose installations
docker --version
docker-compose --version