← Projects

multipass-compose archived

Compose Multipass VMs like a … charm

multipass-compose

multipass-compose is docker-compose for Canonical’s Multipass. You describe a few Ubuntu VMs in one YAML file and bring them up or tear them down together.

The project is archived - the repository has been read-only since 2023-11-21. If you need this today, lima / colima is the maintained alternative. It is kept here for reference.

Why

Doing this by hand means running multipass launch several times with the same flags, setting up cloud-init on each machine, and keeping track of which VM is which. multipass-compose puts it in one file.

The usual case is cloud-infrastructure work: you want a few real VMs on your laptop to test provisioning against, without spinning anything up in an actual cloud.

Features

  • One file - all your VMs live in a single multipass-compose.yaml, docker-compose style.
  • Per-machine sizing - CPU, memory, and disk set per VM.
  • cloud-init - give each machine a cloud-init config for first-boot setup.
  • Provisioning - configure machines after boot over SSH (password or key) or with Ansible.
  • Apple Silicon and Intel - the same file runs on both.

Install

Multipass has to be installed first, then the CLI with Go:

brew install --cask multipass   # prerequisite: Multipass
go install github.com/petr-korobeinikov/multipass-compose/cmd/multipass-compose@latest

Usage

Describe the machines in multipass-compose.yaml:

services:
  web-server:
    image: focal
  database:
    image: focal
  backend:
    image: focal

Then run:

multipass-compose up       # launch every machine
multipass-compose status   # check their state
multipass-compose down     # stop and remove them

Tech stack

  • Go, installed via go install
  • A YAML manifest that drives the Multipass CLI
  • cloud-init for first-boot config, Ansible for provisioning
  • GitHub - source and releases (archived, read-only, MIT)
  • Documentation - quick start, install, guides
  • Showcase - nine examples, from one VM to Ansible provisioning