Container management with LXC

Program Management and Updates

Using the container console, update the installed packages in the usual way with apt-get update followed by apt-get upgrade. By using the package manager, you can install additional software packages from the listed sources. To access a wider program selection, add the desired repositories to the /etc/apt/sources.list file in the container (Listing 4). You do not need to start the updates from within the running container: You can also do this with lxc-attach from the host [3].

Listing 4

Adding Repositories


Preferably, you should run the updates in one fell swoop on the host system. In Listing 5, the shell script updates the host, terminates all active containers, and then restarts them individually for updating. The -qq switch that follows apt-get suppresses all output – use it only after a successful test run. The same applies for -y ("yes"), which waives all commands without prompting. The lxc-wait command in the update loop ensures that the container is ready for operation.

Listing 5

Updating Host System



In the Debian Administrator's Handbook [4] you will find some valuable information on using LXC with Debian and Debian-based distributions. Additionally, you can find detailed information about the network configuration for containers online [5], as well on display redirection for GUI applications [6].

The Author

Harald Zisler has focused on FreeBSD and Linux since the early 1990s. He writes magazine articles and books on engineering and computer-related topics and offers Linux and database training in small groups.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • LXC: Linux Containers

    LXC is fully integrated into the kernel, providing a fast and easy approach to virtualizing individual programs and whole systems on Linux without the need for patches and additional modules.

  • Podman

    Podman gives users a quick and easy way to set up a Nextcloud instance for home use.

  • Linux Dash and Cockpit

    Linux Dash and Cockpit are small-scale solutions for monitoring a cloud-hosted virtual server from home.

  • Security Lessons: cgroups and LXC

    The big virtualization tools like KVM and Xen can’t compete on a small scale with resource-spare cgroups and Linux Containers.

  • Perl: Testing Modules with Docker

    If you want to distribute your programs across multiple platforms, you need to prepare them to run in foreign environments from the start. Linux container technology and the resource-conserving Docker project let you test your own Perl modules on several Linux distributions in one fell swoop.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More