ElementaryOS 0.4: Install LXD for container

Table of Contents

1 Install LXD

The following script will install LXD with apt.

#!/bin/shset -esudo apt install -y lxd lxd-client lxd-tools zfsutils-linux criu# Initialize LXD with NAT network.sudo lxd waitreadycat <<EOF | sudo lxd inityesdefaultdirnoyesyeslxdbr0autoautoEOF# Add user to lxd group.sudo gpasswd -a “${USER}” lxd# Reboot for updating group.sudo reboot

2 Run container

This can download linux image and run it. IP address is assigned to container.

$ lxc launch images:fedora/26 fedora<snip>$ lxc exec fedora ip a s1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWNgroup default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever4: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueuestate UP group default qlen 1000 link/ether 00:16:3e:77:a8:e6 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet6 fe80::216:3eff:fe77:a8e6/64 scope link tentative valid_lft forever preferred_lft forever

Android | Linux | SDL - Narrow Escape