DEV Community

Vishal Raj
Vishal Raj

Posted on

Introduction to Canonical Multipass

Containers have taken the world by the storm. Be it the application containers such as Docker or Rocket, or the operating system containers such as OpenVZ, LXC/LXD or Multipass.

I have always found containers pretty fascinating. The reason being that they provide with a neat & clean interface to start with and once you are done, all the mess can be cleaned up as if it was never there.

In this post we will have a look at Multipass, which is an operating system containerzation technology by Canonical, the company behind Ubuntu. Multipass is available for Windows, Mac & Linux. For the insallation instruction for your particular operating system, please see

  • For Linux, click here
  • For Mac, click here
  • For Windows, click here

NOTE: If you are running Windows Professional, then Multipass can use the built-in Hyper-V technology. Alternatively you will have to install Oracle Virtualbox separately, to use Multipass.

Lets dive into how to use Multipass.

The simplest way to launch an Ubuntu VM is

PS C:\Users\visha> multipass launch
Launched: wise-llama
PS C:\Users\visha> multipass list
Name            State         IPv4         Image
wise-llama      Running       N/A          Ubuntu 20.04 LTS
PS C:\Users\visha>
Enter fullscreen mode Exit fullscreen mode

The will create an Ubuntu vm with the latest LTS version. Now whenever a new VM is created, of course some resources (RAM, CPU, Disk space etc) will be allocated. To list them out

PS C:\Users\visha> multipass info wise-llama
Name:           wise-llama
State:          Running
IPv4:           N/A
Release:        Ubuntu 20.04.1 LTS
Image hash:     69138d4bbf4f (Ubuntu 20.04 LTS)
Load:           0.00 0.04 0.05
Disk usage:     1.2G out of 4.7G
Memory usage:   125.3M out of 981.3M
PS C:\Users\visha>
Enter fullscreen mode Exit fullscreen mode

By default, 1 CPU, 1 GB of RAM & 5 GB of disk space is allocated. This can be changed by passing parameters when launching the VM. To know about the paramters

PS C:\Users\visha> multipass help launch
Enter fullscreen mode Exit fullscreen mode

This will output all parameters which can be passed to multipass launch. Lets launch an Ubuntu VM with custom configuration.

multipass launch -v -c 2 -d 10G -m 2G -n bionic 18.04
Enter fullscreen mode Exit fullscreen mode

Once the VM has been created, we can issue a command to it from the host machine directly.

PS C:\Users\visha> multipass exec bionic -- lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic
PS C:\Users\visha>
Enter fullscreen mode Exit fullscreen mode

Alternatively, we can get direct access to shell inside the VM.

PS C:\Users\visha> multipass shell bionic
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-124-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat Nov 28 06:06:54 +04 2020

  System load:  0.17              Processes:             84
  Usage of /:   22.1% of 4.67GB   Users logged in:       0
  Memory usage: 11%               IP address for enp0s3: 10.0.2.15
  Swap usage:   0%


0 packages can be updated.
0 updates are security updates.

New release '20.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@bionic:~$
Enter fullscreen mode Exit fullscreen mode

Now we are inside of the ubuntu bionic instanace. You can use this like any other ubuntu instance. Once we are done, then we can stop the running instance(s) so that the allocated RAM & CPU becomes free and goes back to the host machine. But since we have just stopped the VM, hence the disk space is still occupied. In order to recover the disk space, the VM must be deleted & purged.

multipass delete <vm-nam>
multipass purge
Enter fullscreen mode Exit fullscreen mode

For the full list of commands supported by multipass, just run multipass without any arguments. To know more about a specific command run - multipass help <command>

PS C:\Users\visha> multipass
Usage: Program Files\Multipass\bin\multipass.exe [options] <command>
Create, control and connect to Ubuntu instances.

This is a command line utility for multipass, a
service that manages Ubuntu instances.

Options:
  -?, -h, --help  Display this help
  -v, --verbose   Increase logging verbosity. Repeat the 'v' in the short option for more detail. Maximum verbosity is obtained with 4 (or more) v's, i.e. -vvvv.

Available commands:
  delete    Delete instances
  exec      Run a command on an instance
  find      Display available images to create instances from
  get       Get a configuration setting
  help      Display help about a command
  info      Display information about instances
  launch    Create and start an Ubuntu instance
  list      List all available instances
  mount     Mount a local directory in the instance
  purge     Purge all deleted instances permanently
  recover   Recover deleted instances
  restart   Restart instances
  set       Set a configuration setting
  shell     Open a shell on a running instance
  start     Start instances
  stop      Stop running instances
  suspend   Suspend running instances
  transfer  Transfer files between the host and instances
  umount    Unmount a directory from an instance
  version   Show version details
PS C:\Users\visha>
Enter fullscreen mode Exit fullscreen mode

That will be all folks!!

For the case where Multipass is using VirtualBox, you need to download PSExec and the use the command

PS> & $env:USERPROFILE\Downloads\PSTools\PsExec.exe -s -i $env:VBOX_MSI_INSTALL_PATH\VirtualBox.exe
Enter fullscreen mode Exit fullscreen mode

Top comments (0)