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
Labs

Managing Files on LXD Containers

LXD offers a command-line interface for efficiently managing files on our Linux containers. We can both push and pull files to and from our containers, or leverage the `edit` command to edit files without ever having to log in to the container directly. In this lab, we'll be using all of these commands to configure Apache on an Ubuntu Linux host.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 15m
Published
Clock icon Apr 03, 2020

Contact sales

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

Table of Contents

  1. Challenge

    Create the containerhub Configuration

    1. Copy an existing profile:

      lxc file pull web01/etc/apache2/sites-available/000-default.conf containerhub.conf
      
    2. Update the containerhub.conf file:

      vim containerhub.conf
      
      <VirtualHost *:80>
       ServerName www.containerhub.example
      
       ServerAdmin hub@localhost
       DocumentRoot /var/www/html
      
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
      
      </VirtualHost>
      
    3. Push the file to the container:

      lxc file push containerhub.conf web01/etc/apache2/sites-available/containerhub.conf
      
    4. Confirm the file was added:

      lxc file edit web01/etc/apache2/sites-available/containerhub.conf
      
  2. Challenge

    Enable the New Configuration

    1. Remove the old 000-default.conf configuration from the sites-enabled directory:

      lxc file delete web01/etc/apache2/sites-enabled/000-default.conf
      
    2. Enable the new configuration:

      lxc exec web01 -- a2ensite containerhub
      lxc exec web01 -- systemctl reload apache2
      
  3. Challenge

    Test the New Configuration

    1. Update the index.html file to say a simple sentence:

      lxc file edit web01/var/www/html/index.html
      
      Website test
      
    2. Retrieve the private IP address of the container:

      lxc list
      
    3. Curl the website:

      curl <web01_private_ip>
      

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