Skip to content

Instantly share code, notes, and snippets.

@brianoflan
Last active October 3, 2017 02:12
Show Gist options
  • Save brianoflan/3e7a9d9af7697749a01df218bf68c72e to your computer and use it in GitHub Desktop.
Save brianoflan/3e7a9d9af7697749a01df218bf68c72e to your computer and use it in GitHub Desktop.
For spinning up a lightweight Debian Docker server VM
#!/bin/bash
# With ability to mount a CIFS/Samba share the way one might
# with a cheap external hard drive attached to an expensive WiFi router.
main() {
set -x
# update-alternatives --list editor
sudo update-alternatives --set editor /usr/bin/vim.tiny
sudo apt-get -y update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 2>&1 | egrep 9DC8 || { echo "ERROR: Wrong fingerprint."; sudo apt-key fingerprint 0EBFCD88; exit 1; }
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
sudo apt-get -y install docker-ce cifs-utils
sudo usermod -aG docker user1
sudo bash -c 'echo -e "\n//192.168.1.1/USB_Storage /mnt/nas cifs uid=user1,user=user1,password=nopassword,noserverino,x-systemd.automount,x-systemd.idle-timeout=1min,_netdev 0 0" >> /etc/fstab'
sudo mount -a
}
main;
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment