vaheeD khoshnouD

linux, mikrotik, macosx

Step by step Ubuntu LXD

Written by vaheeD on January 6, 2016
Step by step Ubuntu LXD
1 vote, 5.00 avg. rating (93% score)

sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get install lxd

lxd-images import ubuntu --alias ubuntu

=======================Your first container================
lxc image list
lxc launch ubuntu first
lxc list
lxc info first
lxc config show first
=======================Limiting resources=================
free -m
lxc exec first -- free -m
lxc config set first limits.memory 64MB
lxc exec first -- free -m
lxc exec first -- apt-get update
lxc exec first -- apt-get dist-upgrade -y
lxc exec first -- apt-get autoremove --purge -y

lxc snapshot first clean

lxc exec first -- rm -Rf /etc /usr

lxc exec first -- bash

lxc restore first clean

lxc exec first -- bash
========================Creating images===================
lxc publish first/clean --alias clean-ubuntu
lxc delete first
lxc launch clean-ubuntu second
=======================Accessing files from the container=
lxc file pull second/etc/hosts .
echo " my-example" >> hosts
lxc file push hosts second/etc/hosts
lxc file pull second/var/log/syslog - | less
lxc delete second
=======================Use a remote image server=========
lxc remote add images
lxc image list images: | less
lxc launch images:centos/7/amd64 third
lxc exec third -- cat /etc/redhat-release
lxc delete third
lxc remote list
=======================Interact with remote LXD servers=
lxc list tryit:
lxc image list tryit:
lxc launch clean-ubuntu tryit:fourth
lxc exec tryit:fourth bash
lxc copy tryit:fourth tryit:fifth
lxc move tryit:fifth sixth
lxc start sixth
lxc exec sixth -- bash
lxc delete sixth
lxc delete tryit:fourth
lxc image delete clean-ubuntu

iptables -t nat -A PREROUTING -p tcp --dport 9000 -j DNAT --to

Step by step Ubuntu LXD
1 vote, 5.00 avg. rating (93% score)