Skip to content

OCI

PVE 9.1 supports direct OCI container execution without LXC/VM.

Add OCI Image

{NODE} ➔ {STORAGE} ➔ CT Templates ➔ Pull from OCI Registry

  • Reference: ghcr.io/{ORG}/{PROJECT} # Query tags before setting tag.
  • Tag: {RELEASE}

Creation

Very similar to LXC container creation. Mount options can be added via advanced options or directly in /etc/pve/lxc/{ID}.conf before starting.

Currently OCI conversions can only mount disk images for container mount points, not bind mounts.

  • Only use SSH key as there is no login user.
  • Use Proxmox Firewall. Most containers do not have built-in firewalls.
  • Directly add data disk during creation:
    • Mount Point ID: 0
    • Disk size: 1
    • Path: /app/config # Use OCI image mount points.
    • Backup: ✔
    • Mount options: discard, noatime

Upgrade OCI Container

To upgrade an OCI container it must be deleted and re-created with the new image.

Prepare Config (State) Disk first.

{LXC} ➔ More ➔ Remove

  • Purge from job configuration: ✔
  • Destroy unreferenced disks owned by guest: ✘

Create OCI container as normal, attaching existing config disk before starting the new container.

Re-create PVE firewall rules

Most containers do not have firewalls built in and existing rules are removed when the container is deleted.

Config (State) Disk Preparation

Most OCI containers have a specific disk used to persistent state. Backup disk then use either method to prevent the disk from being deleted during the upgrade.

Always make a manual backup of the config disk

cp /d/pve/images/{VID}/vm-{VID}-disk-1.raw /d/pve/images/oci-images

Use either CLI or WebUI preparation.

CLI Preparation

cp /d/pve/images/{VID}/vm-{VID}-disk-1.raw /d/pve/images/oci-images
vim /etc/pve/lxc/{VID}.conf  # Remove mounted config disk.

# Perform container upgrade (see: Upgrading), then remount disk.
cp /d/pve/images/oci-images /d/pve/images/{VID}/vm-{VID}-disk-1.raw
vim /d/pve/lxc/106.conf  # Add mounted config disk.

WebUI Preparation

Move disk to another container temporarily during upgrade.

{LXC} ➔ Resources ➔ MP{#} ➔ Volume Action ➔ Reassign Owner

  • Target Guest: {TEMP HOST}
  • Add as: Unused 1

Create new container.

{LXC} ➔ Resources ➔ MP{#} ➔ Volume Action ➔ Reassign Owner

  • Target Guest: {UPGRADE HOST}
  • Add as: Unused 1

Manually edit LXC config to set mountpoint.

Troubleshooting

Error: unable to get PID for CT {VID} (not running?)

Currently being investigated, best guess below

OCI container created without config disk, existing disk mounted post-create. Suspicion is that a special process happens in the OCI conversion process that is not handled if manually adding a mountpoint.

unable to get PID for CT 106 (not running?)

Create OCI container with a new mounted config disk. Replace config disk after container is spun up with one that has existing data.