Skip to content

Instantly share code, notes, and snippets.

@kevinelliott
Last active June 24, 2025 19:01
Show Gist options
  • Save kevinelliott/edd4d4c47ec6b84cadb51508989edc98 to your computer and use it in GitHub Desktop.
Save kevinelliott/edd4d4c47ec6b84cadb51508989edc98 to your computer and use it in GitHub Desktop.
Proxmox: Create a minimal Alpine cloud-init template w/ docker, docker-compose

Download Alpine Linux Virt image

  1. Visit Alpine Linux Downloads and copy the URL for the Virtual image associated with your Proxmox architecture.
  2. Paste the URL in to download on your ISO Images storage drive in your Proxmox datacenter.

Create the initial VM that will become the template

  • Wizard Tabs
    • General
      • VM ID: 9001 (or next available in the 9000 series.
      • Name: alpine-3.22-cloudinit
      • Tags: alpine, alpine-3.22
    • OS
      • Use the ISO image
      • Keep the defaults for Guest OS
    • System
      • Machine: q35
      • BIOS: SeaBIOS
      • Qemu Agent checked
    • Disks
      • Storage: zfs-iscsi (or whichever you use)
      • Disk size: 1 (1gb is a sane start, can change later per VM)
    • CPU
      • Sockets: 1
      • Cores: 1 (these can be changed later per VM)
      • Type: host
    • Memory
      • Memory: 1024 (default to a low 1024mb, can be changed later per VM)
      • Ballooning Device unchecked

Install

  • Boot it up.
  • Login as root and there is no password required.
  • setup-alpine
    • Select keyboard layout: us
    • Select variant: us
    • Hostname: alpine-3.22-cloudinit
    • Interface: eth0
    • SSH: openssh
    • Disk: sda --> sys
  • reboot
  • Login as root using your password
  • apk update
  • apk add -u apk-tools nano
  • nano /etc/apk/repositories and uncomment the community
  • apk update
  • apk upgrade --available
  • sync

Additions

  • apk add docker docker-compose
  • rc-update add docker boot
  • apk add cloud-init util-linux sudo openssh-server-pam e2fsprogs-extra qemu-guest-agent nfs-utils cfdisk
  • rc-update add qemu-guest-agent
  • service qemu-guest-agent start
  • rc-update add nfsmount boot
  • echo 'UsePAM yes' > /etc/ssh/sshd_config.d/usepam.conf
  • service sshd restart
  • sync
  • setup-cloud-init
  • echo "datasource_list: ['NoCloud']" > /etc/cloud/cloud.cfg.d/02-datasource.cfg
  • poweroff

Add Cloud-Init Drive

  • Hardware --> Add --> CloudInit Drive
    • Storage: zfs-iscsi
  • Click Cloud-Init
    • User: admin
    • Password: something secret
    • IP Config: DHCP

Now convert it to a template.

After Clone and Boot

  • Setup NFS
    • apk add nfs-utils
    • rc-update add nfsmount boot
    • rc-service nfsmount start
    • Make NFS mount points (i.e. mkdir -p /nfs/media)
    • Setup /etc/fstab (i.e. 192.168.13.10:/mnt/tank/media /nfs/media nfs rsize=8192,wsize=8192,timeo=14,intr 0 0)
    • mount -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment