Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Introduction

Intro to go here explaining LXD versus LXC and why you want to use it.

Setup 

...

Images

...

Cached Images in Image Store

List images currently cached in the image store. There should be none to start,

lxc image list

Image Servers

LXD has 3 image server lists by default,

Image Server LIstPurposeComment
ubuntu:Ubuntu stable images.We'll be working with this one.
ubuntu-daily:

images:All Linux distributions.For example you can load a RedHat Linux alternative distrobution.

Pulling Image Server Lists

Let's look at the ubuntu: list,

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)  |
+--------------------+--------------+--------+-------------------------------------------------+---------+----------+-------------------------------+
...

The output table from list is not very clear. I don't understand what to reference to use the "launch" command. Will put explanation here once figured out. Here is what I can tell,

Example "launch" Command ReferenceColumnNote
ubuntu:16.04

ubuntu:6041c5e200b6FINGERPRINTWill specifically reference the specific image in the list.g

...

At this point LXD is all setup and ready to use.

Spinning Up an LXD Container

...

lxc launch ubuntu:16.04 container01

This command does the following simultaneously,

  1. References the ubuntu: Image Server List
    1. Looks for 16.01 images
    2. Matches the current architecture of the machine you are on (in my example 
  2. Checks the cache Image Store for the required image
  3. Download (if not in Image Store) the target image
  4. Setup Container called container01 with default settings
  5. Install the target image into container01
  6. Start container01

We can see the downloaded target image,

lxc image list
+-------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
| ALIAS | FINGERPRINT  | PUBLIC |                 DESCRIPTION                 |  ARCH  |   SIZE   |         UPLOAD DATE          |
+-------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
|       | f4c9feb3e401 | no     | ubuntu 16.04 LTS amd64 (release) (20161205) | x86_64 | 143.53MB | Dec 22, 2016 at 3:37am (UTC) |
+-------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+

Now instead of empty, we see the downloaded image which matches our architecture.

Also, let's look at the running container. The commands are only slightly different than using straight LXC

lxc list
+-------------+---------+----------------------+------+------------+-----------+
|    NAME     |  STATE  |         IPV4         | IPV6 |    TYPE    | SNAPSHOTS |
+-------------+---------+----------------------+------+------------+-----------+
| container01 | RUNNING | 10.94.217.171 (eth0) |      | PERSISTENT | 0         |
+-------------+---------+----------------------+------+------------+-----------+


# Inspect the container,
lxc info container01


Name: container01
Remote: unix:/var/lib/lxd/unix.socket
Architecture: x86_64
Created: 2016/12/22 03:37 UTC
Status: Running
Type: persistent
Profiles: default
Pid: 19681
Ips:
  eth0:	inet	10.94.217.171	vethDXUYOE
  eth0:	inet6	fe80::216:3eff:fe07:69ea	vethDXUYOE
  lo:	inet	127.0.0.1
  lo:	inet6	::1
Resources:
  Processes: 26
  Disk usage:
    root: 144.32MB
  Memory usage:
    Memory (current): 23.24MB
    Memory (peak): 45.28MB
...

Managing Containers Between Hosts

The most compelling reason to use LXD is that it can be transported easily between containers.

Reference

Gives more details on initializing lxd - https://insights.ubuntu.com/2016/03/16/lxd-2-0-installing-and-configuring-lxd-212/

Official Ubuntu documentation - https://linuxcontainers.org/lxd/getting-started-cli/

Try Online Interactive Tutorial - https://linuxcontainers.org/lxd/try-it/

  • No labels