Skip to content

Instantly share code, notes, and snippets.

@shankscoder
Last active October 14, 2024 19:46
Show Gist options
  • Select an option

  • Save shankscoder/fb77850622cc6e231bf96fa2f874dbf1 to your computer and use it in GitHub Desktop.

Select an option

Save shankscoder/fb77850622cc6e231bf96fa2f874dbf1 to your computer and use it in GitHub Desktop.
Multi-Arch Ubuntu Docker Installers... with agnostic Docker installer
#!/bin/bash
# SSM user didn't start in home dir, so go there
cd
curl https://gist.github.com/shankscoder/67401d7a36e712b51db9766b97901223/raw/5bf906ef0d1b0d7fc351a3da42a7ce51471a145d/swap-awslinux.sh | sudo bash
sudo yum install docker containerd git screen -y
sleep 1
wget https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)
sleep 1
sudo mv docker-compose-$(uname -s)-$(uname -m) /usr/libexec/docker/cli-plugins/docker-compose
sleep 1
chmod +x /usr/libexec/docker/cli-plugins/docker-compose
sleep 5
systemctl enable docker.service --now
sudo usermod -a -G docker ec2-user
echo -e "\n#####################\nDocker and Compose Installed\n"
#!/bin/sh
echo "\n\n##################################\n\nUpdate and Upgrade Ubuntu and Add Swap\n\n##################################\n\n"
curl https://gist.githubusercontent.com/shankscoder/67401d7a36e712b51db9766b97901223/raw/8212243e954403d292b8884d320a5d05fa70319a/swap.sh | sudo sh
sudo apt-get update && apt-get upgrade -y
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl https://gist.githubusercontent.com/shankscoder/fb77850622cc6e231bf96fa2f874dbf1/raw/c88e9b88df35c83b5de95c26a28f5bf58b1b020f/ubuntu-agnostic-docker-installer.sh | sudo sh
echo "\n\n##################################\n\nInstall Complete\n\n##################################\n\n"
#!/bin/sh
echo "\n\n##################################\n\nInstall DOCKER WITH COMPOSE PLUGIN\n\n##################################\n\n"
sudo apt-get update
echo "\nInstall dependencies ..."
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
echo "\nConfiguring package sources ..."
sudo mkdir -p /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.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
# Install Docker
echo "\nInstalling docker..."
sudo apt-get install docker-ce -y
# Add non-root user to docker group
echo "\nAdding user to docker group..."
sudo usermod -aG docker $USER
echo "\n\n##################################\n\nDocker Install Complete\n\n##################################\n\n"
#!/bin/sh
curl https://gist.githubusercontent.com/shankscoder/67401d7a36e712b51db9766b97901223/raw/8212243e954403d292b8884d320a5d05fa70319a/swap.sh | sudo sh
#sudo apt-get update && apt-get upgrade -y
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
# Docker Compose Installation as a container. Change version to latest version to run correct version
sudo curl -L --fail https://github.com/docker/compose/releases/download/1.29.2/run.sh -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Ubuntu Self-Management and Security
# sudo apt-get install -y fail2ban unattended-upgrades
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment