This page offers more in-depth information on LXD itself. To learn how to set up LXD with Juju see Using LXD with Juju.
The topics presented here are:
- Useful LXD client commands
- Using the LXD snap
- LXD logs
- Further LXD help and reading
Useful LXD client commands
There are many client commands available. Some common ones, including those covered above, are given below.
|creates an LXD container
|lists all LXD containers
|deletes an LXD container
lxc remote list
|displays status of localhost
lxc info <container>
|displays status of container
lxc config show <container>
|displays configuration of container
lxc image info <alias or fingerprint>
|displays status of image
lxc exec <container> <executable>
|runs program on container
lxc exec <container> /bin/bash
|spawns shell on container
lxc file pull <container></path/to/file> .
|copies file from container
lxc file push </path/to/file> <container>/
|copies file to container
lxc stop <container>
lxc image list
|lists cached images
lxc image alias delete <alias>
|deletes image alias
lxc image alias create <alias> <fingerprint>
|creates image alias
lxc cluster list
|lists cluster nodes
lxc cluster show <container>
|displays configuration of a cluster node
Using the LXD snap
The LXD project will soon be moving from the APT installation method (Debian package) to installing via a snap. Some users may want to opt in early, before building their infrastructure, as moving to the snap entails a migration of containers. The LXD snap is very well tested (as is the included migration tool).
First ensure that
snapd is installed:
sudo apt install snapd
On Ubuntu 14.04 LTS (Trusty), installing
snapd will bring in a new kernel (4.4.0 series) as a dependency. You will then need to reboot. Attempting to install a snap without doing so will result in failure.
Now install the LXD snap:
sudo snap install lxd
If LXD is already installed via APT and there are no existing containers under the current installation then simply remove the software:
sudo apt purge liblxc1 lxcfs lxd lxd-client
If containers do exist under the old system the
lxd.migrate utility should be used to migrate them so that they can be managed by the snap binaries. Once the migration is complete, you will be prompted to have the old software removed.
Start the migration tool by running:
LXD itself logs to
/var/log/lxd/lxd.log and Juju machines created via the LXD local provider log to
/var/log/lxd/juju-UUID-machine-ID. However, the standard way to view logs is with the
debug-log command (see the Juju logs page for details).
For LXD snap users, the log directory is located at
Further help and reading
lxc --help for more information on LXD client usage and
lxd --help for assistance with the daemon. See upstream documentation for LXD configuration.