LXD Container Revolution

Boot Instance

LXC

LXD

sudo lxc-create -n $CONTAINER_NAME -t debian -- -r wheezy
sudo lxc-start -n $CONTAINER_NAME
lxc launch wheezy $CONTAINER_NAME

Binary Image name

Template (bash script) name

Restart Instances

LXC

LXD

for i in container0 container1; do
  sudo lxc-stop -n $i
  sudo lxc-start -n $i
done
lxc restart container0 container1

Trash Instances

LXC

LXD

for i in container0 container1; do
  sudo lxc-destroy -f -P $LXC_PATH -n $i
done
lxc delete -f container0 container1

Bind mount

LXC

LXD

MOUNT="lxc.mount.entry = /some/path dest/path none defaults,bind,uid=0,create=dir 0 0"
LXC_PATH="${LXC_PATH-/var/lib/lxc}"
grep $MOUNT $LXC_PATH/$CONTAINER_NAME/config || echo $MOUNT | sudo tee -a $MOUNT
sudo lxc-stop -P $LXC_PATH -n $CONTAINER_NAME
sudo lxc-start -P $LXC_PATH -n $CONTAINER_NAME
lxc config device add $CONTAINER_NAME srv disk \
    path=/dest/path source=/source/path

LXD Container Revolution

By James Pic

LXD Container Revolution

  • 1,397