Customize a LXC template ?

not thinking too complicated... you can build anything in you template... no rules (anything that is possible, so for example, not NFS)

Thank you for your response ;)

So, I deploy a container, I customize it, it is OK, and how can I deploy this customized container ton another container ?
 
Change to the root directory of your LXCcontainer, directly on you PVEhost, then make an packages:
Code:
tar -czf /home/iso-images/template/cache/custom-16.04-desktop_16.04-1_amd64.tar.gz *
 
thats not possible with LXC - there is no simfs, so you don't see the FS from the containers!

but it's so mutch more easy - make a simple backup with vzdump! (from the host shell oder via GUI)
use "stop mode" & "tar.gz" & and afterwards move the xyz.tar.gz from you backup folder to the templates folder (in a standart setup from
/var/lib/vz/dump/xyz.tar.gz to /var/lib/vz/template/cache/debian-8.0-custom_8.4_amd64.tar.gz )
 

Attachments

  • Bildschirmfoto 2016-08-27 um 11.49.00.png
    Bildschirmfoto 2016-08-27 um 11.49.00.png
    99.4 KB · Views: 43
Last edited:
Thanks for all the help on this - I was stumped until I found this thread.

I took a few mins and wrote up a step-by-step tutorial on how to do this and shared it on /r/homelab and /r/proxmox. As a new forum user I can't share links, so you'll have to work a bit to view this: reddit [dot] com /r/homelab/comments/5xvfbf/how_to_proxmox_modify_a_ct_container_template
 
Glade I happened upon this thread - I was looking to do the same thing and the suggestions above were very helpful. Unfortunately, when I try to rollout a new CT based on the template created, I get the following error message when it starts extracting:
Code:
tar: ./var/spool/postfix/dev/urandom: Cannot mknod: Operation not permitted
tar: ./var/spool/postfix/dev/random: Cannot mknod: Operation not permitted
Total bytes read: 718407680 (686MiB, 59MiB/s)
tar: Exiting with failure status due to previous errors
TASK ERROR: command 'lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 -- tar xpf /proc/self/fd/12 --totals --one-file-system -p --sparse --numeric-owner --acls --xattrs '--xattrs-include=user.*' '--xattrs-include=security.capability' '--warning=no-file-ignored' '--warning=no-xattr-write' -C /var/lib/lxc/107/rootfs --skip-old-files --anchored --exclude './dev/*'' failed: exit code 2
Managed to find another thread in the forums that reference this error so just thought I'd take the liberty of mentioning as a caution to others who are planning to do this, at least with unprivileged containers. It looks like there's no easy solution to this problem, according to the other thread.
 
i will try it to explain it in english:

1) download a normal lxc / openvz template
2) create an lxc container with this template
3) boot it
4) open it (pct enter <id>)
5) install / modificat everything you want
6) remove all network interfaces
7) shutdown the container
8) make a backup with vzdump an select tar.gz
9) move an rename the backupfile from ...../dump/xyz.tar.gz to ..... /templates/cache/name-version.tar.gz
10) use your new template as any other

Has anynone try this way?
I tried it and it work,
template can work but this template you can't run in Unprivileged mode

I had tried many way to customize my LXC template so far no way to build a template can run in Unprivileged mode
does anyone has idea what happen?
only original template can run in Unprivileged mode
 
emplate can work but this template you can't run in Unprivileged mode
Remove postfix, and then test again, on us templates this was the problem, if the lxc is running in unprivileged mode, then you can install posfix again.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!