1

Docker Installation

I figured after installing docker and docker compose 3-4 times I might as well make a script for it.

Last updated: 2/6/2026

I needed to reinstall docker and docker compose multiple times when creating new VMs or CTs so I created the following script.

The script

#!/bin/bash
 
# Update the package list
sudo apt-get update
 
# Install prerequisite packages
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
 
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 
# Set up the Docker stable repository
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
 
# Update the package list again
sudo apt-get update
 
# Install Docker packages
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
 
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 
# Apply executable permissions to the Docker Compose binary
sudo chmod +x /usr/local/bin/docker-compose
 
# Verify installation
sudo docker --version
sudo docker-compose --version

Running the script

Naturally after making the script I wasn't going to just copy and paste it every time I needed it, so I uploaded the script to my CDN.

If you have curl installed already

curl -O https://cdn.romitsagu.com/Files/Docker/DockerInstall.sh && bash DockerInstall.sh

If you don't have curl

apt update && apt install curl -y && curl -O https://cdn.romitsagu.com/Files/Docker/DockerInstall.sh && bash DockerInstall.sh