warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

LXC Containers

# Create Ubuntu 16.04 Xenial LXC container
sudo lxc-create --template ubuntu --name xenial -- template-options -r xenial

# Create Ubuntu 14.04 Trusty LXC container
sudo lxc-create --template ubuntu --name trusty -- template-options -r trusty

# Create Debian 9 Stretch LXC container
sudo lxc-create --template debian --name stretch -- template-options -r stretch

# centos
sudo lxc-create -t centos -n centos -- --release 7

# nested container / docker support
echo "lxc.aa_profile = unconfined" >> /var/lib/lxc/centos/config

Update LXC container templates filesystem

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/scripts/lxc-update-templates.sh -O - | bash -


# ensure that this script is run as root
if [ $(id -u) -ne 0 ]; then
  sudo $0

# set language to english

# update APT rootfs (Debian and Ubuntu)
for DIST in $(find /var/cache/lxc/*/* -maxdepth 0 -type d); do
  echo "Updating ${DIST} ..."
  /usr/sbin/chroot "${DIST}" apt-get update -qq
  /usr/sbin/chroot "${DIST}" apt-get dist-upgrade -qq -y
  /usr/sbin/chroot "${DIST}" apt-get autoremove -qq -y
  /usr/sbin/chroot "${DIST}" apt-get clean

# fix dns
echo "nameserver" > /var/cache/lxc/debian/rootfs-wheezy-amd64/etc/resolv.conf

echo "0 13 * * * root /usr/bin/wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/scripts/lxc-update-templates.sh -O - | bash -" > /etc/cron.d/lxc_update_template
service cron restart

# fix squeeze repository
sed -i 's|cdn.debian.net|ftp.debian.org|g' /var/cache/lxc/debian/rootfs-squeeze-amd64/etc/apt/sources.list

Syndicate content