Free Hosting Online for WorkStations

< Previous | Contents | Next >

This section will describe the simplest container tasks. 5.5.1. Creating a container

Every new container is created based on either an image, an existing container, or a container snapshot. At install time, LXD is configured with the following image servers:

ubuntu: this serves official Ubuntu server cloud image releases.

ubuntu-daily: this serves official Ubuntu server cloud images of the daily development releases.


39 http://open-zfs.org

40 https://github.com/lxc/lxd/blob/master/doc/configuration.md


images: this is a default-installed alias for images.linuxcontainers.org. This is serves classical lxc images built using the same images which the LXC 'download' template uses. This includes various distributions and minimal custom-made Ubuntu images. This is not the recommended server for Ubuntu images.


The command to create and start a container is


lxc launch remote:image containername


Images are identified by their hash, but are also aliased. The 'ubuntu' server knows many aliases such as '16.04' and 'xenial'. A list of all images available from the Ubuntu Server can be seen using:


lxc image list ubuntu:


To see more information about a particular image, including all the aliases it is known by, you can use:


lxc image info ubuntu:xenial


You can generally refer to an Ubuntu image using the release name ('xenial') or the release number (16.04). In addition, 'lts' is an alias for the latest supported LTS release. To choose a different architecture, you can specify the desired architecture:


lxc image info ubuntu:lts/arm64


Now, let's start our first container:


lxc launch ubuntu:xenial x1


This will download the official current Xenial cloud image for your current architecture, then create a container using that image, and finally start it. Once the command returns, you can see it using:


lxc list lxc info x1


and open a shell in it using:



lxc exec x1 bash


The try-it page gives a full synopsis of the commands you can use to administer containers.


Now that the 'xenial' image has been downloaded, it will be kept in sync until no new containers have been created based on it for (by default) 10 days. After that, it will be deleted.


Top OS Cloud Computing at OnWorks: