LXC#LXD
{{Short description|Operating system-level virtualization for Linux}}
{{Other uses}}
{{Infobox software
| title = Linux Containers
| name = LXC
| logo = Linux Containers logo.svg
| screenshot =
| caption =
| collapsible =
| author =
| developer = {{ubl|Kernel: Virtuozzo, IBM, Google, Eric Biederman and others|Userspace: Daniel Lezcano, Serge Hallyn, Stéphane Graber and others}}
| released = {{Start date and age|2008|08|06}}{{cite web |url=https://linuxcontainers.org/downloads/ |title= Downloads |website= Linux containers |access-date= 2014-11-10 |archive-date=2014-11-10 |archive-url= https://web.archive.org/web/20141110124113/https://linuxcontainers.org/downloads/ |url-status= dead }}
| latest release version = {{wikidata|property|reference|edit|P348}}
| latest release date = {{Start date and age|{{wikidata|qualifier|P348|P577}}|df=no}}
| programming language = C, Shell
| operating system = Linux
| platform = x86, IA-64, PowerPC, SPARC, Itanium, ARM
| size =
| language =
| genre = OS-level virtualization
| license = GNU LGPL v.2.1 (some components under GNU GPL v2 and BSD)
| website = {{URL|http://linuxcontainers.org}}
}}
Linux Containers (LXC) is an operating system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel.
The Linux kernel provides the cgroups functionality that allows limitation and prioritization of resources (CPU, memory, block I/O, network, etc.) without the need for starting any virtual machines, and also the namespace isolation functionality that allows complete isolation of an application's view of the operating environment, including process trees, networking, user IDs and mounted file systems.{{cite web | url = https://www.cs.ucsb.edu/~rich/class/cs293b-cloud/papers/lxc-namespace.pdf | title = Resource management: Linux kernel namespaces and cgroups | date = May 2013 | access-date = February 11, 2015 | author = Rami Rosen | website = CS | publisher = UCSB}}
LXC combines the kernel's cgroups and support for isolated namespaces to provide an isolated environment for applications.{{Cite web |last=Kenlon |first=Seth |date= 2020-01-30 |title=Exploring simple Linux containers with lxc | publisher = IBM |url= https://www.redhat.com/sysadmin/exploring-containers-lxc |access-date=2023-07-05 |website=Red Hat}} Early versions of Docker used LXC as the container execution driver, though LXC was made optional in v0.9 and support was dropped in Docker v1.10.{{Cite news |url= https://blog.docker.com/2014/03/docker-0-9-introducing-execution-drivers-and-libcontainer/|title=Docker 0.9: introducing execution drivers and libcontainer |date=2014-03-10| publisher =Docker | work = Blog|access-date= 2018-05-09 |language= en-US}}{{Cite web|url= https://docs.docker.com/engine/release-notes/prior-releases/#1100-2016-02-04 | publisher =Docker | work = Engine release notes | title = 1.10.0 |date= 2016-02-04 |access-date= 2020-10-06}}
Overview
LXC was initially developed by IBM, as part of a collaboration between several parties looking to add namespaces to the kernel.{{Cite web |last=Webb |first= Jordan |date=2022-09-13 |title=LXC and LXD: a different container story |url=https://lwn.net/Articles/907613/ |access-date=2023-07-05 |website=LWN.net}} It provides operating system-level virtualization through a virtual environment that has its own process and network space, instead of creating a full-fledged virtual machine. LXC relies on the Linux kernel cgroups functionality{{Cite web |last=Koutoupis |first=Petros |date= 2018-08-27 |title=Everything You Need to Know about Linux Containers, Part II: Working with Linux Containers (LXC) |url= https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc |access-date=2023-07-05 |website=Linux Journal}} that was released in version 2.6.24. It also relies on other kinds of namespace isolation functionality, which were developed and integrated into the mainline Linux kernel.
Security
Originally, LXC containers were not as secure as other OS-level virtualization methods such as OpenVZ: in Linux kernels before 3.8, the root user of the guest system could run arbitrary code on the host system with root privileges, just as they can in chroot jails.{{cite web|last= Marco |first= d'Itri |title= Evading from linux containers|url=http://blog.bofh.it/debian/id_413| work = BOFH | access-date=12 February 2014 | place = IT |archive-url= https://web.archive.org/web/20140109184419/http://blog.bofh.it/debian/id_413 |archive-date= 9 January 2014|year=2011}} Starting with the LXC 1.0 release, it is possible to run containers as regular users on the host using "unprivileged containers".{{cite web|last=Graber|first=Stéphane|title=LXC 1.0: Security features [6/10]|url=https://www.stgraber.org/2014/01/01/lxc-1-0-security-features/|access-date= 12 February 2014|date=1 January 2014|quote=However, at least in Ubuntu, our default containers ship with what we think is a pretty good configuration of both the cgroup access and an extensive apparmor profile which prevents all attacks that we are aware of. [...] LXC is no longer running as root so even if an attacker manages to escape the container, he’d find himself having the privileges of a regular user on the host}} Unprivileged containers are more limited in that they cannot access hardware directly. However, even privileged containers should provide adequate isolation in the LXC 1.0 security model, if properly configured.
Alternatives
LXC is similar to other OS-level virtualization technologies on Linux such as OpenVZ and Linux-VServer, as well as those on other operating systems such as FreeBSD jails, AIX Workload Partitions and Solaris Containers. In contrast to OpenVZ, LXC works in the vanilla Linux kernel requiring no additional patches to be applied to the kernel sources. Version 1 of LXC, which was released on 20 February 2014 as a long-term supported version, was supported for five years.{{cite web|url=https://www.stgraber.org/2013/12/20/lxc-1-0-your-first-ubuntu-container/ |title=LXC 1.0: Your first Ubuntu container |first=Stéphane |last=Graber |publisher=St. Graber |date=2013-12-20 |access-date=2014-02-23}} LXC 4.0 will be supported until June 1, 2025 and LXC 5.0 until June 1, 2027.{{cite web|url=https://linuxcontainers.org/lxc/introduction/ |title= LXC | work = Linux containers |access-date= 2023-02-07}}
= LXD =
LXD is an alternative Linux container manager, written in Go. It is built on top of LXC and aims to provide a better user experience.{{Cite web |url= https://linuxcontainers.org/lxd/introduction/ | work = LXD | title = Introduction | publisher = Linux Containers |access-date=2020-04-14}} It is a container hypervisor providing an API to manage LXC containers.{{Cite web |last=Parrott |first=Thomas |title=Introduction to LXD projects |url= https://ubuntu.com/tutorials/introduction-to-lxd-projects#1-overview |access-date=2023-07-05 |website=Ubuntu | publisher = Canonical}} The LXD project was started in 2015 and was sponsored from the start by Canonical Ltd., the company behind Ubuntu. On 4 July 2023, the LinuxContainers project announced that Canonical had decided to take over the LXD project but a fork called Incus was made.{{Cite web |date=2023-07-04 |title= LXD Has been moved to Canonical |url=https://linuxcontainers.org/lxd/ |archive-url=https://web.archive.org/web/20230704204731/https://linuxcontainers.org/lxd/ |archive-date= 2023-07-04 |access-date=2023-07-05 |website=Linux Containers}}{{Cite web |last=Rudra |first=Sourav |date=2023-07-05 |title=The LXD Project Finds a New Home at Canonical |url=https://news.itsfoss.com/canonical-lxd-project/ |access-date=2023-07-05 | work = It’s Foss}} On August 25, 2023, LXD version 5.17 was officially released under the control of Canonical, providing support for OpenZFS 2.2 delegation capabilities.{{Cite web |last=Parrott |first= Thomas |date=25 August 2023 |title=LXD 5.17 has been released |url=https://discourse.ubuntu.com/t/lxd-5-17-has-been-released/38061 |website=Ubuntu | publisher = Canonical}}
See also
{{Portal|Free and open-source software|Linux}}
- Open Container Initiative
- Container Linux (formerly CoreOS Linux)
- Docker, a project automating the deployment of applications inside software containers
- Apache Mesos, a large-scale cluster management platform based on container isolation
- Operating system-level virtualization implementations
- Proxmox Virtual Environment, an open-source server virtualization management platform supporting LXC containers and KVM
- Anbox, uses LXC to execute Android applications in other Linux distributions
References
{{Reflist|30em}}
External links
{{Div col|colwidth=30em}}
- {{Official website|http://linuxcontainers.org}} and {{GitHub|lxc|source code repository}}
- [http://www.ibm.com/developerworks/linux/library/l-lxc-containers/ IBM developerworks article about LXC]
- [http://blog.bofh.it/debian/id_413 "Evading from Linux Containers" by Marco D'Itri]
- [http://www.haifux.org/lectures/299/netLec7.pdf Presentation about cgroups and namespaces, the underlying technology of Linux containers, by Rami Rosen]
- [http://haifux.org/lectures/320/netLec8_final.pdf Presentation about Linux Containers and the future cloud, by Rami Rosen]
- [https://wiki.deimos.fr/LXC_:_Install_and_configure_the_Linux_Containers LXC : Install and configure the Linux Containers]
- [https://lwn.net/Articles/515034/ LSS: Secure Linux containers] (LWN.net)
- [http://z900collector.wordpress.com/linux/containers/ Introduction to Linux Containers]
- {{YouTube|id=UpIFByNLM5U|title=LXC on Android}}, April 2013
{{div col end}}
{{Virtualization software}}
{{Linux kernel}}
Category:Free virtualization software
Category:Linux kernel features
Category:Linux-only free software