Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


These scripts are useful to manage your own server, with several Linux containers.


  • Either clone this code repository: cd ~; git clone scripts
  • Or install a package from LBS:
  • There is a lxc-scripts package for CentOS7, and Ubuntu 20.04, with instructions how to install the package
  • To make things easier, I usually create a symbolic link: cd ~; ln -s /usr/share/lxc-scripts scripts

After installing the package, run these scripts for initializing the firewall and some fixes for the LXC templates:


CheatSheet for my LXC scripts

  • Initialise the host IPTables so that they will be survive a reboot: ~/scripts/
  • Small fixes to the LXC system for CentOS7 containers, and create ssh keys: ~/scripts/
  • Create a container (with networking etc): ~/scripts/ $name $id
  • Call the script without parameters to see additional parameters, eg to specify the version of the OS etc: ~/scripts/
  • There are scripts for creating CentOS, Debian, and Ubuntu containers
  • Containers are created in /var/lib/lxc/$name, see the file config and the directory rootfs
  • Start a container: lxc-start --name $name
  • Start a container without console: lxc-start -d --name $name
  • Stop a container: lxc-stop -n $name
  • Destroy a container: lxc-destroy --name $name
  • List all containers, with running state and IP address: lxc-ls -f
  • alternatively, there is this script: ~/scripts/ which works even on CentOS where python3 is not (yet) available
  • this also shows the OS of the container
  • ~/scripts/ running: shows only running containers
  • ~/scripts/ stopped: shows only stopped containers
  • Stop all containers: ~/scripts/


  • are stored in /var/lib/lxcsnaps/
  • first stop the container: lxc-stop -n $name
  • then create the snapshot: lxc-snapshot -n $name
  • create with comment: echo "mycomment" > /tmp/comment && lxc-snapshot -n $name -c /tmp/comment && rm -f /tmp/comment
  • list all snapshots: lxc-snapshot -LC -n $name
  • restore a snapshot: lxc-snapshot -n $name -r snap@
  • create a new container from snapshot: lxc-snapshot -n $name -r snap@ new$name
  • delete a snapshot: lxc-snapshot -n $name -d snap@


scripts useful for running a server with several lxc containers. DEPRECATED. Please use!



No releases published


No packages published