Skip to content

Instantly share code, notes, and snippets.

@lanmower
Last active May 8, 2022 08:21
Show Gist options
  • Save lanmower/9499c23a45ce7ba0fd01f9013438b6d5 to your computer and use it in GitHub Desktop.
Save lanmower/9499c23a45ce7ba0fd01f9013438b6d5 to your computer and use it in GitHub Desktop.
# INSTALL DOCKER
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
sudo ufw disable
# Accept all traffic first to avoid ssh lockdown via iptables firewall rules #
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
# Flush All Iptables Chains/Firewall rules #
sudo iptables -F
# Delete all Iptables Chains #
sudo iptables -X
# Flush all counters too #
sudo iptables -Z
# Flush and delete all nat and mangle #
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -t raw -F
sudo iptables -t raw -X
sudo iptables-save > /etc/iptables/rules.v4
sudo ip6tables-save > /etc/iptables/rules.v6
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile swap swap defaults 0 0" | sudo tee /etc/fstab > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment