...
Code Block | ||
---|---|---|
| ||
sudo reboot |
Reconfigure
...
Add Users to the lxd Group
By default, users cannot yet use LXD until you add them to the reserved group. In this example, I'm adding my account,
Code Block | ||
---|---|---|
| ||
sudo dpkgusermod -reconfigurea -pG mediumlxd lxd |
Basic LXD Commands
...
tin.pham |
Reminder that if you use your own account, you need to log out then log back in.
Verify LXD is Working
Basic test to verify lxd is working and it will also generate your random client certificate (used by LXD to secure calls) on your account,
Code Block | ||
---|---|---|
| ||
sudolxc usermodimage -alist -G lxd username+-------+-------------+--------+-------------+------+------+-------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | +-------+-------------+--------+-------------+------+------+-------------+ |
At this point we have no LXD images.
Basic LXD Commands
To view your bridge information.
Code Block | ||
---|---|---|
| ||
lxc profile edit default |
Notice the following,
Code Block | ||
---|---|---|
| ||
name: default config: {} description: Default LXD profile devices: eth0: nictype: bridged parent: lxdbr0 type: nic name: default |
What we see here is that the containers will be handed IPs from the LXD bridge and exist within the LXD network.
Warning |
---|
Tin is refining the 2nd pass of this article ... I am currently at this point. |
Images
...
Cached Images in Image Store
...
Image Server LIst | Purpose | Comment |
---|---|---|
ubuntu: | Ubuntu stable images. | We'll be working with this one. |
ubuntu-daily: | ||
images: | All Linux distributionsdistriibutions. | For example you can load a RedHat Linux alternative distrobution. |
...
Code Block | ||
---|---|---|
| ||
lxc image list ubuntu: | less
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE |
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
| p (5 more) | 6041c5e200b6 | yes | ubuntu 12.04 LTS amd64 (release) (20161205) | x86_64 | 156.47MB | Dec 5, 2016 at 12:00am (UTC) |
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
| p/armhf (2 more) | c19b1fff3336 | yes | ubuntu 12.04 LTS armhf (release) (20161205) | armv7l | 135.19MB | Dec 5, 2016 at 12:00am (UTC) |
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
| p/i386 (2 more) | ce5c6821eebb | yes | ubuntu 12.04 LTS i386 (release) (20161205) | i686 | 139.28MB | Dec 5, 2016 at 12:00am (UTC) |
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
...
# Reduce the list to your machine architecture, in my case and most it will be amd64
lxc image list ubuntu: amd64 |
The output table from list is not very clear. I don't understand what to reference to use What you reference when using the "launch" command . Will put explanation here once figured out. Here is what I can tellis the main part of the ALIAS name ignoring anything in brackets. For example to install and launch other distrobusions based off of the images: list which has all Linux distributions,
Example "launch" Command Reference | Column | Note |
---|---|---|
ubuntu:16.04 | This will download from the Ubuntu image server grabbing the latest 16.04 matching your machines architecture, win in my case amd64. | |
ubuntu:6041c5e200b6 | FINGERPRINT | Will specifically reference the specific image in the list. |
images:centos/7 | Go against the "images" image server, download the latest cantos version 7 matching your machines architecture. | |
images:centos/6/amd64 | In this example, specifies Specifies the latest version 6 and specifies the architecture to use. |
At this point LXD is all setup and ready to use.
...
There are two key methods. Clone semi-live using snapshots and shutting down first.
Note |
---|
Investigate if cloning between different lxd versions is supported and to what extent. |
Shutdown Approach
Log into myhost02
...
Code Block | ||
---|---|---|
| ||
lxc file push sourcefile container/path/to/directory/ lxc file pull container/path/to/file directory |
Reconfigure
If you need to reconfigure the bridge you can by using this command.
Code Block | ||
---|---|---|
| ||
sudo dpkg-reconfigure -p medium lxd |
Reference
Initializing LXD - https://insights.ubuntu.com/2016/03/16/lxd-2-0-installing-and-configuring-lxd-212/
...
Live Container Migrations - https://bobcares.com/blog/lxc-live-migration-to-minimize-business-downtime/
Mounting a local folder - https://tribaal.io/nicer-mounting-home-in-lxd.html