Vzdump how to get proxmox templates

Daniel's blog

Created by Daniel Ziegler

Today I had the case that I had to create 33 LXC containers that looked the same. Base packages such as,,, and so on should be installed in every LXC container.

In addition, I wanted my apt cacher-ng to be used directly, the correct one to be loaded in all containers and the proxy server to be entered everywhere.

This could of course also be done using an automation tool such as Ansible or Puppet to be able to solve. However, the effort is usually a bit bigger, all the rules in Ansible and co. A container template, on the other hand, is built quickly.

Preparations

So far, I have always adapted my LXC templates directly on the Proxmox VE server.

It is important that I will not create a completely new template, but will adapt an existing template. Why should you do the work that others have already done for you?

In order to be able to install software within the template, the package must be installed on the system on which you want to adapt the template.

Adjust template

Proxmox VE saves the LXC templates under.

I will adapt the template for myself, since everything runs on Ubuntu for me.

First I copy the original template, because of course I don't want to break it.

After unpacking you have the file system of the container in front of you.

If you just want to adjust a few files, you can do so right here. For example put apt-cacher-ng in the file or put a proxy server in.

Danger: The missing one at the beginning is not a typo! You are not yet "inside" the template, only the files are on the hard drive.

Install programs in the LXC template

Now it's getting interesting.

With the command I now jump into the LXC template.

From now on I am "within" the LXC template. So I can install anything that I need here or change files as I want.

So that the container can resolve DNS requests, you must first set your DNS server.

After everything has been installed and adjusted, you can leave the container again.

To reduce the size of the template, you should delete all downloaded packages from.

You can leave the container with or again.

Create a new template

Now I create a new one with the name of the adapted template.

Then you can simply copy the template back to the others

and sees it immediately in the Proxmox VE web interface.

Now you can create LXC containers that use the adapted template.

So that you can see straight away that this container was created from a customized template, I just put my CrateDB ASCII logo packed.

Create many LXC containers at once

Fortunately, Proxmox VE has a practical tool to create LXC containers via the CLI. If you want to know more about it, you should read once.

Here is a small example of what creates an LXC container with 2 CPU cores, 4GB RAM and 12GB HDD: