Skip to content

Instantly share code, notes, and snippets.

@kampta
Created August 23, 2016 16:07
Show Gist options
  • Save kampta/1846c118f69271fd17f5a2052a8e24ab to your computer and use it in GitHub Desktop.
Save kampta/1846c118f69271fd17f5a2052a8e24ab to your computer and use it in GitHub Desktop.
Add swap space in all digitalocean docker-machines when you run out of them
for i in $(docker-machine ls | grep digitalocean | awk '{print $1}'); do docker-machine ssh $i -- ls /swapfile || docker-machine ssh $i "fallocate -l 512M /swapfile && chmod 400 /swapfile && mkswap /swapfile" && docker-machine ssh $i "swapon /swapfile && echo '/swapfile none swap defaults 0 0' >> /etc/fstab" &>/dev/null; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment