.. _Updating Containers:

Updating Containers
-------------------

Virtuozzo provides two means of keeping your containers up to date:

-  Updating EZ templates software packages inside a particular container by means of the ``vzpkg`` utility. Using this facility, you can keep any of the containers existing on your hardware node up to date.

-  Updating caches of the OS EZ templates installed on the hardware node. This facility allows you to create new containers already having the latest software packages installed.

.. _Updating EZ Template Packages in Containers:

Updating EZ Template Packages in Containers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Virtuozzo allows you to update packages of the OS EZ template a container is based on and of any application EZ templates applied to the container. You can do it by using the ``vzpkg update`` utility. Assuming that the container ``MyCT`` is based on the ``centos-6-x86_64`` OS EZ template, you can issue the following command to update all packages included in this template:

::

    # vzpkg update 26bc47f6-353f-444b-bc35-b634a88dbbcc centos-6-x86_64
    ...
      Updating: httpd                ### [1/4]
      Updating: vzdev                ### [2/4]
      Cleanup : vzdev                ### [3/4]
      Cleanup : httpd                ### [4/4]
    Updated: httpd.i386 0:2.0.54-10.2 vzdev.noarch 0:1.0-4.swsoft
    Complete!
    Updated:
     httpd                  i386      0:2.0.54-10.2
     vzdev                  noarch    0:1.0-4.swsoft

.. note::

    1. Updating EZ templates is supported for running containers only.

    2. If you are going to update the cache of a commercial OS EZ template (e.g., Red Hat Enterprise Server 5 or SLES 10), you should first update software packages in the remote repository used to handle this OS EZ template and then proceed with updating the EZ template cache.

As you can see from the example above, the ``httpd`` and ``vzdev`` applications have been updated for the ``centos-6-x86_64`` OS EZ template. If you wish to update all EZ templates (including the OS EZ template) inside the container ``MyCT`` at once, execute this command:

::

    # vzpkg update 26bc47f6-353f-444b-bc35-b634a88dbbcc
    ...
    Running Transaction
      Updating  : hwdata               #### [1/2]
      Cleanup   : hwdata               #### [2/2]
    Updated: hwdata.noarch 0:1.0-3.swsoft
    Complete!
    Updated:
     hwdata                 noarch    0:0.158.1-1

In the example above, only the ``hwdata`` package inside the container ``MyCT`` was out of date and updated to the latest version.

.. _Updating OS EZ Template Caches:

Updating OS EZ Template Caches
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

With the release of new updates for the corresponding Linux distribution, the created OS EZ template cache can become obsolete. Virtuozzo allows you to quickly update your OS EZ template caches using the ``vzpkg update cache`` command.

.. note:: If you are going to update the cache of a commercial OS EZ template (e.g., Red Hat Enterprise Server 6 or SLES 11), you should first update software packages in the remote repository used to handle this OS EZ template and then proceed with updating the EZ template cache.

When executed, ``vzpkg update cache`` checks the ``cache`` directory in the template area (``/vz/template/cache`` by default) on the hardware node and updates all existing tarballs in this directory. However, you can explicitly indicate the tarball for what OS EZ template should be updated by specifying the OS EZ template name. For example, to update the tarball for the ``centos-6-x86_64`` OS EZ template, run this command:

::

    # vzpkg update cache centos-6-x86_64
    Loading "rpm2vzrpm" plugin
    Setting up Update Process
    Setting up repositories
    base0            100% |=========================|  951 B    00:00
    base1            100% |=========================|  951 B    00:00
    base2            100% |=========================|  951 B    00:00
    base3            100% |=========================|  951 B    00:00
    ...

Upon the ``vzpkg update cache`` execution, the old tarball name gets the ``-old`` suffix (e.g., ``centos-x86.tar.gz-old``).

You can also pass the ``-f`` option to ``vzpkg update cache`` to remove an existing tar archive and create a new one instead of it.

If the ``vzpkg update cache`` command does not find a tarball for one or several OS EZ templates installed on the server, it creates tar archives of the corresponding OS EZ templates and puts them to the ``/vz/template/cache`` directory.

