Multipass Cheatsheet

Here is the link to get Multipass.

If you install Multipass on Windows, you should first install Hyper-V (you could install VirtualBox instead, but Hyper-V is recommened).

This looks like a good resource

Getting Familiar with Multipass

Before creating the swarm, you can get familiar with Multipass by following this tutorial. I've summarized the tutorial in the following commands.

To see all the images that are avaialble (notice that docker is one of them):

multipass find

Create a vm with from a docker image:

multipass launch docker --name somenameforthevm

To inspect it:

multipass info vmnamegoeshere

To create a vm and specify the ram, disk size, and cpus

multipass launch docker --name somename --memory 2G --disk 4G --cpus 2

To stop/start a vm:

multipass stop vmname
multipass start vmname

To delete a vm:

multipass delete vmnamegoeshere

Deleted vms can be restored with multipass recover vmname.

To permanently remove deleted vms: multipass purge

To login to a shell on a vm:

multipass shell vmnamegoeshere

Use exit to exit the shell

To list all vms:

multipass list

Copying/Sharing Files

Use the transfer command.

To copy a file from the host to an instance (this copies to the home dir of the vm):

multipass transfer some_file.txt vmname:.

To copy a folder recursively (copies myfolder to the home directory on the instnace):

multipass transfer --recursive --parents "C:\Users\YourUsername\Documents\myfolder" vmname:myfolder

Note that the --parents will create the myfolder dir on the instance if it is not already there.

You can mount a folder on the host to a vm like so (I'm not sure about how to replace the ~ for windows hosts)

multipass mount ~/folderName vmname

To make sure the mount was successfull:

multipass info vmname

You should see the mount listed and the path on how to navigate into it after you shell into the vm.

To unmount the folder:

multipass unmount vmname

Snapshots

To create a snapshot of a vm (the vm must not be running when you take the snapshot):

multipass snapshot vmname -c "some comment about the snapshot"

The output will be something like: vmname.snapshot1.

To see the snapshots created for a vm:

multipass info vmname --snapshots

To restore the snapshot:

multipass restore vmname.snapshot1