LinuxAlternative

Linux · Ferramentas do Sistema

LXC

LXC is a lightweight container system that runs multiple isolated Linux systems on a single host using OS-level virtualization.

Código abertoGrátis
Seja o primeiro a avaliar
Licença
GPL-2.0
Versão mais recente
7.0.0

O que é o LXC?

LXC, or Linux Containers, provides operating-system-level virtualization to run multiple isolated Linux environments directly on the host kernel. It has been part of the Linux ecosystem since the late 2000s and is mature, stable, and widely used in production environments. Unlike full virtualization, LXC uses cgroups and namespaces to isolate processes, making it efficient and fast.

It's best suited for system administrators, DevOps engineers, and developers who need lightweight, fast, and resource-efficient containers without the abstraction layer Docker adds. If you're comfortable working from the command line and managing Linux systems directly, LXC gives you fine-grained control over containerized environments.

Compared to Docker, LXC feels more like managing real machines than deploying microservices. It doesn’t include built-in orchestration or image registries. If you're used to Windows tools like Docker Desktop or virtual machines via Hyper-V, LXC will feel more manual and closer to the metal — less magic, more control.

Ideal para: System administrators and Linux users who need efficient, low-overhead containers with full control.

Principais recursos do LXC

  • OS-level virtualization using kernel cgroups and namespaces
  • Supports both system and application containers
  • Direct access to host kernel with minimal overhead
  • Scriptable via command-line tools like lxc-create, lxc-start
  • Supports live migration in some configurations
  • Integrates with networking bridges and VLANs
  • Can run unprivileged containers for security
  • Backed by mature init system integration (systemd, upstart)

Prós

  • Extremely lightweight with near-native performance
  • Highly stable and battle-tested in production
  • Fine-grained control over container configuration
  • Runs directly on the host kernel without a hypervisor
  • Well-documented and widely supported across distros

Contras

  • Steeper learning curve compared to Docker
  • Less user-friendly tooling and ecosystem
  • Primarily command-line driven, limited GUI options
  • Not ideal for developers used to high-level abstractions

Programas do Windows que o LXC substitui

Como instalar o LXC no Linux

Ubuntu / Mintsudo apt install lxc
Debiansudo apt install lxc
Fedorasudo dnf install lxc
Arch / Manjarosudo pacman -S lxc
openSUSEsudo zypper install lxc

Dicas para quem vem do Windows

If you're coming from Docker, think of LXC containers as full system instances rather than single-process services. You manage them like lightweight VMs — with init systems, networking, and services starting on boot. Configuration is done via config files and CLI tools, not Dockerfiles. Data isn't automatically shared; you'll need bind mounts or custom networking setups. Learn the lxc-* commands and default container templates to get started quickly.

LXC: perguntas frequentes

Is LXC the same as Docker?

No. LXC runs full system containers similar to lightweight VMs, while Docker focuses on application containers. Docker abstracts more and is designed for microservices, whereas LXC gives you more control and runs entire OS instances.

Can LXC run on any Linux distribution?

Yes, LXC is available on most major distributions including Debian, Ubuntu, Fedora, Arch, and openSUSE. It requires a recent Linux kernel with cgroups and namespaces enabled, which most modern distros support by default.

Are unprivileged containers supported in LXC?

Yes, LXC supports unprivileged containers using user namespaces, allowing non-root users to run isolated environments securely. This improves security but requires proper UID/GID mapping setup.

What’s the difference between system and application containers in LXC?

System containers start a full init process and behave like traditional servers. Application containers run a single service. LXC is optimized for system containers, unlike Docker which focuses on the latter.

Atualizado em