#!/bin/bash
# Update the package index
sudo apt update
# Install prerequisites for Docker
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
# Add Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add 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 index again (with Docker repository)
sudo apt update
# Install Docker
sudo apt install -y docker-ce docker-ce-cli containerd.io
# Add the current user to the docker group (to run Docker commands without sudo)
sudo usermod -aG docker $USER
# 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
# Print Docker and Docker Compose versions
docker --version
docker-compose --version
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)