When working with Linux Containers (LXC) on Enterprise Linux 6 systems, administrators face a fundamental choice between two distinct approaches:
- The native
lxc-*
command suite (lxc-create, lxc-start, etc.) - Red Hat's recommended libvirt-based management
Here's how the two methods differ in implementation:
# Native LXC method
lxc-create -n web01 -t centos -- -R 6
lxc-start -n web01 -d
# Libvirt method
virsh -c lxc:/// define /etc/libvirt/qemu/web01.xml
virsh start web01
Key points from Red Hat's documentation:
- LXC is marked as "Technology Preview" in RHEL 6
- Primary support is through libvirt interface
- Direct use of lxc-* tools is discouraged for production
For those needing to choose between approaches:
Feature | Native LXC | Libvirt |
---|---|---|
Template Support | Full | Limited |
Networking | Flexible | Simplified |
Monitoring | Basic | Integrated with virt tools |
Future Compatibility | Uncertain | Officially supported |
Many shops use both methods strategically:
# Create container with lxc-create
lxc-create -n db01 -t oraclelinux -- -R 6.5
# Then manage with libvirt
virsh -c lxc:/// define /var/lib/lxc/db01/config
virsh start db01
Common issues and solutions:
- Missing Templates:
yum install libvirt lxc libvirt-daemon-driver-lxc
- Permission Errors:
setsebool -P virt_use_nfs 1
- Networking Problems:
brctl addbr lxcbr0
ip link set dev lxcbr0 up
Given RHEL 6's approaching EOL, consider:
- Testing migration to newer LXC/Docker versions
- Evaluating podman for container workloads
- Planning upgrades to RHEL 7/8 where LXD is available
When working with containers on Red Hat Enterprise Linux 6 or CentOS 6, administrators face a fundamental choice between native LXC tools (lxc-create
, lxc-start
, etc.) and libvirt's container management. Red Hat officially classifies LXC as a "Technology Preview" while recommending libvirt as the supported interface.
The traditional method using raw LXC commands provides direct control but requires more manual configuration. Here's a typical workflow:
# Install LXC
yum install lxc lxc-templates
# Create a CentOS container
lxc-create -n mycontainer -t centos
# Basic container management
lxc-start -n mycontainer -d
lxc-console -n mycontainer
lxc-stop -n mycontainer
Red Hat's preferred approach leverages libvirt's unified interface for both containers and VMs:
# Install required packages
yum install libvirt libvirt-client virt-install
# Create container definition
cat > centos6-container.xml <
centos6-virt
524288
1
exe
/sbin/init
EOF
# Start container
virsh -c lxc:/// define centos6-container.xml
virsh -c lxc:/// start centos6-virt
Feature | Native LXC | Libvirt-LXC |
---|---|---|
Red Hat Support Status | Technology Preview | Supported |
Management Interface | Command-line tools | Unified libvirt API |
Networking | Direct configuration | libvirt networking |
Storage | Manual setup | libvirt storage pools |
Monitoring | Custom scripts | virsh commands |
For existing systems using native LXC, gradual migration paths include:
- Converting container configs to libvirt XML definitions
- Using libvirt's LXC backend for new containers
- Implementing wrapper scripts that output libvirt-compatible configurations
For new deployments on RHEL6/CentOS6:
- Use libvirt when possible for better support and integration
- Maintain native LXC skills for troubleshooting
- Consider using both approaches where appropriate (e.g., libvirt for management, direct LXC for debugging)