Skip to content

Containers in Proxmox VE

Henryk Paluch edited this page Feb 3, 2024 · 2 revisions

Containers in Proxmox VE

It should be easy but there are few quirks.

First you need to get suitable "Template" (tarball with container content) as describe on:

For example:

pveam update
pveam available --section system
pveam download debian-11-standard_11.3-1_amd64.tar.zst
pveam download local debian-11-standard_11.3-1_amd64.tar.zst
pveam list local

Next you have to enable content type rootdir so it will be offered as storage. In my case I simply did this:

pvesm status
cat /etc/pve/storage.cfg 
# ensure that you do NOT remove any existing content type:
pvesm set local --content iso,vztmpl,backup,rootdir,images
cat /etc/pve/storage.cfg 

Using dir storage "chroot"

Normally recent Proxmox allows you to use only Volumes (images formatted with filesystem) from GUI, as pointed out on:

Creating subdir storage is possible from CLI only, for example:

pct create 402 /var/lib/vz/template/cache/debian-11-standard_11.3-1_amd64.tar.zst \
    --hostname deb11-ct --rootfs local:0 --password SecurePassword

You can verify that VM filesystem is real subdirectory using command like this:

ls -l /var/lib/vz/images/402/subvol-402-disk-0.subvol/

Gentoo note

I was curious and tried container with Gentoo using

pveam download local gentoo-current-openrc_20231009_amd64.tar.xz
pct create 224 /var/lib/vz/template/cache/gentoo-current-openrc_20231009_amd64.tar.xz \
 --hostname gentoo-ct --rootfs local:0 --password TopSecretPassword

But when I tried emerge any package (in my case emerge-webrsync && emerge -an tmux, got:

mount: /proc: cannot mount none read-only.
       dmesg(1) may have more information after failed mount system call.
Unable to mark /proc slave: 32
 * The ebuild phase 'die_hooks' has been aborted since PORTAGE_BUILDDIR
 * does not exist: '/var/tmp/portage/dev-libs/libevent-2.1.12-r1'

There exist two workarounds:

Workaround A:

Workaround B:

pct set CONTAINER_ID --features nesting=1

And "power cycle" container (shutdown and start again).

Clone this wiki locally