Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

lxc-slack Helper Script

This is a helper script which I use to quickly build LXC templates and containers for testing Slackware build scripts and packages. It was created on Slackware host, though in theory it should work with any other distro as a host if Slackware's pkgtools are provided.

To get started, edit etc/lxc-slack.conf file first, then run ./lxc-slack without any options to get help. Running ./lxc-slack COMMAND will print usage of the particular command.

This script uses btrfs filesystem to create templates and containers, so make sure that BASE_PATH is in filesystem which is btrfs.

SlackBuild script is included in build directory for those who want to make a package for system-wide installation.

Network

Since I'm mainly using lxc-slack on my laptop with wireless connection, etc/rc.d/rc.lxc_nat script creates a network bridge with a separate network for containers and NATs it to the interface with default route.

All containers are configured to use static IPs.

Running Containers

When container is created, it can be started by using lxc-start:

$ lxc-start -n <name> -d -c <logfile>

-d runs container as daemon, -c writes console output into file. ssh into container by running ssh root@<IP_addr>. Alternatively run

$ chroot ${BASE_PATH}/containers/<name> passwd root

to set root password. Then use lxc-console -n <name> to log in into container directly.

Running container can be stopped by

$ lxc-stop -n <name>

chroot

If you don't want to use LXC and are happy with chroot, you can still benefit from the script by using ./lxc-slack maket to make a template and then chroot into it. You can also use btrfs subvolume snapshot to make cheap clones of the template and quickly dispose them using btrfs subvolume delete when not needed.

Disclaimer

Though lxc-slack does work for me, it may have bugs and fail horribly. Use at your own risk.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.