Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

Instantiating Containers from Base Images with LXC/LXD

With containers being an important part of any dynamic IT organization, understanding how to work with them is a key component to your success as an engineer. In this activity, you will get a chance with work with images and instantiuate containers using the LXD/LXC container management engine. Once you complete this activity, you will have an understanding of how to pull, start and connect to LXC containers running on your host.

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 30m
Clock icon Nov 12, 2018

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Reconfigure the LXC/LXD Host

    Using the requirements from your Activity Guide, you will need to reconfigure the host to be sure the settings are as intended. You can accomplish that with the following command:

    sudo lxd init
  2. Challenge

    Non-privileges User 'cloud_user' Needs to Be Able to Run LXC Commands

    Check /etc/groups, look for the 'lxd' group. If the 'cloud_user' user is not a member, then do:

    sudo usermod -aG lxd cloud_user

    To add them. You WILL Have to log completely off and back in for the membership to pick up in the shell (or start a new bash instance without logging out)

  3. Challenge

    Pull a CentOS 7 Image and Run a Container

    You can launch a container instance called 'myweb' based on the CentOS 7 image provided by the default repositories with the command:

    lxc launch images:centos/7 myweb

    You can verify with

    lxc list

    Which will show the running container. Connecting to it can be done via:

    lxc exec myweb -- /bin/bash

    You will be logged into the container. You can log out with 'exit' and then stop the container with

    lxc stop myweb

    Verify the image is still there with

    lxc image list

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans