Skip to content

Instantly share code, notes, and snippets.

@aric49
Last active September 8, 2017 16:27
Show Gist options
  • Select an option

  • Save aric49/51dc407121bdcf1840905d99989191e0 to your computer and use it in GitHub Desktop.

Select an option

Save aric49/51dc407121bdcf1840905d99989191e0 to your computer and use it in GitHub Desktop.
Bring Up an LXC Development Lab
#!/bin/bash
#Starts a Development Lab using LXC Containers
set -x
function DevLabUp(){
echo "Bringing up the dev lab......"
lxc launch ubuntu:16.04 Lab1 -c security.nesting=true -c security.privileged=true
lxc launch ubuntu:16.04 Lab2 -c security.nesting=true -c security.privileged=true
lxc launch ubuntu:16.04 Lab3 -c security.nesting=true -c security.privileged=true
lxc launch ubuntu:16.04 Lab4 -c security.nesting=true -c security.privileged=true
lxc list
}
function DevLabDown(){
echo "Bringing Down the Dev Lab......."
lxc delete Lab1 --force
lxc delete Lab2 --force
lxc delete Lab3 --force
lxc delete Lab4 --force
lxc list
echo "Lab Successfully Stopped."
}
#DevLabUp
#DevLabDown
Lab_Arg=$1
if [[ $Lab_Arg == "up" ]]; then
DevLabUp
elif [[ $Lab_Arg == "down" ]]; then
DevLabDown
else
echo "I don't know what you mean"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment