| Crates.io | libflux |
| lib.rs | libflux |
| version | 0.1.0 |
| created_at | 2025-09-20 05:04:01.253309+00 |
| updated_at | 2025-09-20 05:04:01.253309+00 |
| description | A secure, performant, and developer-friendly container runtime using Linux namespaces |
| homepage | |
| repository | https://github.com/libflux/libflux |
| max_upload_size | |
| id | 1847414 |
| size | 251,411 |
A secure, performant, and developer-friendly container runtime built with Rust, using Linux namespaces, cgroups, and capabilities. libflux provides a CLI-driven, modular, and extensible alternative to systemd-nspawn and other container runtimes.
CONFIG_USER_NS=y)CONFIG_PID_NS=y)CONFIG_NET_NS=y)CONFIG_UTS_NS=y, CONFIG_IPC_NS=y)CONFIG_CGROUPS=y)CONFIG_OVERLAY_FS=y)ip command (iproute2 package)iptables (for port forwarding)# Clone the repository
git clone https://github.com/libflux/libflux.git
cd libflux
# Build the project
cargo build --release
# Install binary
sudo cp target/release/libflux /usr/local/bin/
# Or install using cargo
cargo install --path .
# Check if your system supports container features
libflux info
# Run a simple command in an isolated environment
sudo libflux run container-name \
--image /path/to/rootfs \
-- /bin/echo "Hello from libflux!"
# Run interactively
sudo libflux run container-name \
--image /path/to/rootfs \
-- /bin/bash
# List running containers
libflux ps
# Output in JSON format
libflux ps --format json
# Create and run a container
sudo libflux run web-server \
--image /opt/alpine-rootfs \
--memory 512M \
--bind /var/www:/var/www \
-- /usr/sbin/httpd
# Run with resource constraints
sudo libflux run limited-container \
--image /opt/ubuntu-rootfs \
--memory 1G \
--cpu-weight 500 \
-- /bin/bash
# Run with custom networking
sudo libflux run web-app \
--image /opt/webapp-rootfs \
--port 8080:80 \
-- /app/server
# Mount host directories
sudo libflux run data-processor \
--image /opt/processor-rootfs \
--bind /host/data:/container/data \
--bind /host/output:/container/output \
-- /app/process
# Set environment variables
sudo libflux run app \
--image /opt/app-rootfs \
--env DATABASE_URL=postgresql://localhost/mydb \
--env DEBUG=true \
-- /app/start
# Run performance benchmark
sudo libflux benchmark \
--count 50 \
--image /opt/test-rootfs \
--command true \
--memory \
--verbose
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLI (libflux) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Container Manager โ โ Main entrypoint, manages lifecycle
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Namespace & Cgroup APIs โ โ Syscall wrappers, resource limits
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Filesystem/Overlay API โ โ Mount, bind, overlay support
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Networking Manager โ โ veth, bridge management
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Logging / Monitoring API โ โ Container output capture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Clone the repository
git clone https://github.com/libflux/libflux.git
cd libflux
# Build in debug mode
cargo build
# Run tests
cargo test
# Build documentation
cargo doc --open
libflux/
โโโ src/
โ โโโ main.rs # CLI entrypoint
โ โโโ container.rs # Container struct & lifecycle
โ โโโ namespace.rs # Namespace management
โ โโโ cgroups.rs # Cgroup management
โ โโโ fs.rs # Filesystem operations
โ โโโ net.rs # Networking
โ โโโ user.rs # UID/GID mapping
โ โโโ config.rs # Runtime configuration
โ โโโ logging.rs # Logging utilities
โ โโโ utils.rs # Helper functions
โ โโโ error.rs # Error types
โโโ tests/ # Integration tests
โโโ Cargo.toml # Dependencies
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)cargo test
# Run integration tests (requires root privileges)
sudo cargo test --test integration
# Create a simple rootfs for testing
mkdir -p /tmp/test-rootfs
# ... populate with basic filesystem structure
# Test basic container functionality
sudo ./target/debug/libflux run test \
--image /tmp/test-rootfs \
-- /bin/echo "Hello, libflux!"
# Test container listing (while a container is running)
./target/debug/libflux ps
# Test benchmarking
sudo ./target/debug/libflux benchmark \
--count 5 \
--image /tmp/test-rootfs
Container creation and startup times (on modern hardware):
Note: Performance may vary based on system configuration and container complexity.
This project is licensed under the MIT License - see the LICENSE file for details.
libflux is currently in early development. While it implements core container functionality, it should not be used in production environments without thorough testing and security review.
Made with โค๏ธ and ๐ฆ by the libflux team