Skip to main content

Launching LXD Containers

Hands-On Lab

 

Photo of Elle Krout

Elle Krout

Content Team Lead in Content

Length

00:15:00

Difficulty

Beginner

LXD, or the Linux Container Daemon, lets us leverage the resource-light LXC virtualization method, as well as providing additional support for the container images we use to spin up our containers. In this lab, we'll pull down and cache two separate images, then create a series of containers based on these images.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Launching LXD Containers

Introduction

LXD, or the Linux Container Daemon, lets us leverage the resource-light LXC virtualization method, as well as providing additional support for the container images we use to spin up our containers. In this lab, we'll pull down and cache two separate images, then create a series of containers based on these images.

The Scenario

As part of the lift-and-shift of a legacy application from virtual machines to Linux containers, you want to potentially explore switching container-level operating systems. Currently, the applications are hosted on Ubuntu 16.04 images, but you wish to make a case for Alpine Linux.

To prepare for this, copy the Alpine Linux 3.10 and Ubuntu 16.04 images to the LXD server, giving them the alpine and ubuntu aliases. When finished, launch two containers: one called alpine-test and one called ubuntu-test, each using their respective images.

Logging In

Use the credentials provided on the hands-on lab overview page, and log in as cloud_user.

Copy the Alpine Linux Image

Copy the image to the LXD server, ensuring to provide an alias:

lxc image copy images:alpine/3.10 local: --alias alpine

Copy the Ubuntu Image

Copy the image to the LXD server, ensuring to provide an alias (this one will take a bit longer):

lxc image copy ubuntu:16.04 local: --alias ubuntu

Launch the Alpine Linux Container

Launch a new container, called alpine-test:

lxc launch alpine alpine-test

Launch the Ubuntu Container

Launch the ubuntu-test container (again, this one will take a little longer than the alpine equivalent did):

lxc launch ubuntu ubuntu-test

Conclusion

Once we confirm that the containers are both running (with lxc list), then we're done. Congratulations!