Difference between revisions of "LXD Cheat Sheet"

From UVOO Tech Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 
```
 
```
 +
lxc init ubuntu:20.04 --vm -c limits.cpu=6 -c limits.memory=12GB juju0
 +
# lxc config set $host limits.cpu=8 limits.memory=16GB
 +
lxc config device override juju0 root size=100GB
 +
 +
 
lxc init win10 --empty --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GB
 
lxc init win10 --empty --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GB
 
lxc init kub ubuntu:20.04 --vm -c limits.cpu=4 -c limits.memory=8GB
 
lxc init kub ubuntu:20.04 --vm -c limits.cpu=4 -c limits.memory=8GB

Latest revision as of 18:45, 12 November 2021

lxc init ubuntu:20.04 --vm -c limits.cpu=6 -c limits.memory=12GB juju0
# lxc config set $host limits.cpu=8 limits.memory=16GB
lxc config device override juju0 root size=100GB


lxc init win10 --empty --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GB
lxc init kub ubuntu:20.04 --vm -c limits.cpu=4 -c limits.memory=8GB
lxc launch ubuntu:18.04 example
lxc launch images:centos/8 example8
sudo lxc config device add example tcp11000 proxy listen=tcp:0.0.0.0:11000 connect=tcp:127.0.0.1:80
sudo ufw status
sudo ufw allow 11000
lxc exec example /bin/bash
apt install -y nginx
exit
http://example:11000/
# Teardown
sudo ufw delete allow 11000
sudo lxc delete -f example8
sudo lxc config device remove example tcp11000
sudo lxc stop example
sudo lxc delete example

reverse proxy/keys are done via nginx reverse proxy
lxc exec adc /bin/bash
/etc/nginx/conf.d/example.conf
We can add your host in as well just use the above example
When you look at how this works I think you will see how easy it is to add this into a really tight ci/cd pipeline
lxc config device add CONTAINER-NAME eth1 nic name=eth1 nictype=bridged parent=lxdbr0
export VM=vm1 lxc stop $VM && lxc config set $VM limits.cpu=4 limits.memory=8GB && lxc start $VM