How to Run LXD Container Instances in Container Station


Last modified date: 2021-10-05

Overview

LXD is the next generation system container manager of Linux containers which is built on top of LXC to provide a new and better user experience.

This tutorial explains how to use Container Station 2.4 to install and run LXD containers.

Note:
LXD containers are only supported by x86-based devices with Container Station 2.4 (or later).
For more information on installing and using Container Station, see How to Use Container Station?

Creating an LXD Container from the Create Page

  1. Open Container Station.
  2. Go to Create.
  3. In the search bar, look for the operating system or distribution you want to install.
    Note:
    Refer to Linux Containers - Image server for supported operating systems and distributions.
  4. Click
  5. Go to the LXD Image Server tab.
  6. Select an image from the list and click Install.

    The Create Container window opens.
  7. In the Create Container window, enter a name and allocate CPU and Memory resources to the LXD container.
    Important:
    If Advanced Folder Permissions are enabled in the Control Panel, privileged mode for the LXD container must be enabled or it will not start.

    Privileged mode can be enabled by following these steps:
    1. Click Advanced Settings >>.
    2. Click Device.
    3. Check Run containers in privileged mode.

  8. Click Create.
    The LXD container is created.

Creating an LXD Container by Pulling an LXD Image from the Image Page

  1. Open Container Station.
  2. Go to Images.
  3. Click Pull.
  4. Select LXD Image Server in Registry.
  5. Enter the desired operating system or distribution in Image Name and desired release version in Image Version.
    Note:
    Refer to Linux Containers - Image server for supported operating systems, distributions and release versions.
  6. Click Pull.

    The LXD image is downloaded as a Background Task. When the download is complete the LXD image will appear in the Images list.
  7. Find the Image in the Images page.
  8. Click .
    The Create Container window opens.
  9. In the Create Container window, enter a name and allocate CPU and Memory resources to the LXD container.
    Important:
    If Advanced Folder Permissions are enabled in the Control Panel, privileged mode for the LXD container must be enabled or it will not start.

    Privileged mode can be enabled by following these steps:
    1. Click Advanced Settings >>.
    2. Click Device.
    3. Check Run containers in privileged mode.

  10. Click Create.
    The LXD container is created.

Creating a User in LXD Containers

Important: For most LXD containers, there will be no default user after the LXD container is created.
 
Note: The following steps use Ubuntu Focal Fossa as an example. The terminal commands may vary based on your operating system and distribution.
  1. Open Container Station.
  2. Go to Containers.
  3. Select your LXD container.
  4. Click Terminal.
  5. Enter /bin/sh in Command.
  6. Click Connect.

    The terminal console is launched in a new browser tab.
  7. Enter adduser {your_username}.
  8. Enter a password and follow the instructions.

    A user will be created for the LXD container.
  9. (optional) To grant sudo access to the user, enter usermod -aG sudo {your_username}
    Important: Sudo access is required to allocate a static IP address to the LXD Container.
  10. Close the terminal console browser tab.
  11. Enter the user credentials in Console.

    The LXD container can now be accessed by the new user.

Setting Up Static IP Address for LXD Containers

Important:
Sudo access is required for a static IP address to be set.
 
Note: The following steps use Ubuntu Focal Fossa as an example. The terminal commands may vary based on your operating system and distribution.
  1. Open Container Station.
  2. Go to Containers.
  3. Select your LXD container.
  4. Enter your user credentials in Console.
  5. Enter the command: sudo vi /etc/netplan/10-lxd.yaml.
  6. Set dhcp4 to false and enter the address, gateway and nameservers based on your environment.
  7. Save the configuration file and enter the command: netplan apply

    The LXD container now has a static IP address.

Was this article helpful?

52% of people think it helps.
Thank you for your feedback.

Please tell us how this article can be improved:

If you want to provide additional feedback, please include it below.

Choose specification

      Show more Less

      This site in other countries/regions:

      open menu
      back to top