====== Ubuntu - LXD containers ======
====Basics====
The LXD container hypervisor. Info: [[https://www.ubuntu.com/containers/lxd]]
* Install LXD:apt-get install lxd
* Initialize LXD:lxd init
* Create a new containter:lxc launch ubuntu:
lxc launch images:centos/7/amd64
* List containers:lxc list
+---------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+---------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
| c1 | RUNNING | 1.2.3.4 (eth0) | fd42:dd7c:afec:9008:216:3eff:aaaa:aaaa (eth0) | PERSISTENT | 0 |
+---------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
| c2 | RUNNING | 1.2.3.5 (eth0) | fd42:dd7c:afec:9008:216:3eff:bbbb:bbbb (eth0) | PERSISTENT | 0 |
+---------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
| c3 | RUNNING | 1.2.3.6 (eth0) | fd42:dd7c:afec:9008:216:3eff:cccc:cccc (eth0) | PERSISTENT | 0 |
+---------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
* Modify DHCP range:lxc network set lxdbr0 ipv4.dhcp.ranges 1.2.3.100-1.2.3.150
* Start shell in container:lxc exec c1 bash
====Bridge====
Configure an unused interface for bridging with containers.
* Install bridge utilities:apt install bridge-utils
* Configure bridge interface:tee -a /etc/network/interfaces.d/br0 <
* Show default settings:lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
name: default
used_by: []
* Edit parent NIC:lxc profile edit default
{{tag>[linux containers lxc lxd ubuntu]}}