Table of Contents
Using LXD/LXC for containers
These commands work on Ubuntu 18.04 with LXD v3.1
Install & Setup
Install
sudo apt install lxd
Configure
sudo lxc
Download initial images database
sudo lxc
Display help for a given command
sudo lxc help [command]
Basic usage
List existing container and their current state
sudo lxc list
Create and start new container
sudo lxc launch images:debian/9 container-name
Connect to container console - To detach from the console, press: <ctrl>+a q
sudo lxc console container-name
Another way to connect to a container
sudo lxc exec container-name /bin/bash
Stop container
sudo lxc stop container-name
Start container
sudo lxc start container-name
More advanced
Snapshots
List current snapshot for a given container
sudo lxc info container-name
Take a snapshot of a container
sudo lxc snapshot container-name [custom_snapshot_name; default=snap#]
Create new container from existing container snapshot
sudo lxc copy container-name snap_name new-container-name