7.2.1. Using Golden Image Functionality

The golden image functionality allows you to preinstall application templates to OS EZ template caches to speed up creating multiple containers based on the same set of OS and application templates. Previously, you could either install application templates to each container after creating it or embed them directly into a custom OS template. Golden image is currently the easiest and fastest way to create containers with preinstalled applications.

The best way to create such a cache is:

  1. Make a custom sample configuration file with information on the OS EZ template to cache and application EZ templates to preinstall. For example:

    # cp /etc/vz/conf/ve-basic.conf-sample \
    /etc/vz/conf/ve-centos-6-x86_64-mysql-devel.conf-sample

    Note

    Note: If you already have a custom sample configuration file with application EZ templates specified in it, you can reuse it instead of creating a new one.

  2. Add the OS EZ template and application EZ template information to the new configuration file. Each OS and application template name must be preceded by a dot. Multiple consecutive application EZ template names must be separated by white spaces. For example:

    # cd /etc/vz/conf
    # echo OSTEMPLATE=".centos-6-x86_64" >> ve-centos-6-x86_64-mysql-devel.conf-sample
    # echo TEMPLATES=".mysql .devel" >> ve-centos-6-x86_64-mysql-devel.conf-sample
  3. Run the vzpkg create appcache command with your configuration file as an option. For example:

    # vzpkg create appcache --config centos-6-x86_64-mysql-devel

    Note

    Note: If the resulting application cache already exists, it will not be recreated and you will see a corresponding message. To recreate an application cache, use the vzpkg update appcache command.

The resulting archive can be found in the /vz/template/cache directory on the hardware node. You can check that it exists and includes necessary application templates with the following command:

# vzpkg list appcache
centos-6-x86_64              2012-07-20 16:51:36
     mysql
     devel