Skip to main content

Simple LXC Guide

Here is a quick reference guide for using lxc
  • Get dependencies
    • $ sudo su
    • $ apt-get install debootstrap
    • $ apt-get install bridge-utils
  • Install
    • $ apt-get install lxc
    • $ apt-get -t trusty-backports install lxd
    • $ apt-get install lxd
  • Importing lxc container to another host.
    • Tar up the container:
      • $ lxc-stop -n <container name>
      • $ cd /var/lib/lxc/<container folder name>/
      • $ tar --numeric-owner -czvf <container name>.tar.gz ./*
    • Unpack in the new host machine:
      • $ lxc image import <rootfs tarball> --alias <export alias>
      • $ lxc launch <export alias> <container name>
  • Running ther container image
    • $ lxc-start --name <container name>
    • $ lxc-console --name <container name>
    • test that it is added
      • sudo lxc-ls
  • References

Comments