Copy link of Raw script
wget URL
chmod +x ./install-docker.sh
sudo ./install-docker.sh
#!/bin/sh | |
set -o errexit | |
set -o nounset | |
IFS=$(printf '\n\t') | |
# Add Docker's official GPG key: | |
sudo apt-get update | |
sudo apt-get install ca-certificates curl -y | |
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 "$VERSION_CODENAME") 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 docker-buildx-plugin docker-compose-plugin -y | |
sudo usermod -aG docker "ubuntu" | |
sudo systemctl enable docker | |
printf '\nDocker installed successfully\n\n' | |
printf 'Waiting for Docker to start...\n\n' | |
sleep 5 | |
if ! docker info > /dev/null 2>&1; then | |
echo "Docker process isn't running - please start docker and try again!" | |
exit 1 | |
fi | |
# Docker Compose | |
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo su - "ubuntu" |