Skip to content

Instantly share code, notes, and snippets.

@kandrejevs
Last active October 2, 2024 15:00
Show Gist options
  • Select an option

  • Save kandrejevs/73f5ce5eeec2d1092198fe9040d816a3 to your computer and use it in GitHub Desktop.

Select an option

Save kandrejevs/73f5ce5eeec2d1092198fe9040d816a3 to your computer and use it in GitHub Desktop.
amazon lightsail startup script to install docker and docker compose and dependencies
# Create swap file
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Install dependencies
apt install -y git curl
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# Configure docker to run without root
groupadd docker
usermod -aG docker ubuntu
eval "$(ssh-agent -s)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment