Ubuntu Multipass is used to quicky launch and manage Linux virtual machines on any workstation. It is available for Linux, MacOS and Windows. From developer’s perspective it is an interesting alternative to Docker or VirtualBox. For me, it feels easier and simpler to use. It has become indispensable tool for keeping my workstation clean. It helps with testing and deployment of my software.
Flame Wars Disclaimer
This article is not about cloud, deployment strategies, Kubernetes, helm, swarms, AWS vs Azure and alike. It’s about using virtual machines to help software developer and devops engineer with daily work.
How does Multipass work?
As simple as this:
# Create and launch new virtual machine named "backend" multipass launch --name backend # Check how it's doing multipass info backend # Run single command on the machine multipass exec backend -- systemctl restart apache # Launch interactive shell session with the machine multipass shell backend # List all instances multipass list # Reboot multipass restart backend # Dispose of the instance multipass delete backend
There are few more commands such as
mount for mounting directories or
transfer for copying files. Detailed documentation is available at https://multipass.run/docs.
What can I do with Multipass?
We agree that virtual machines and containers are most useful tools in developer’s toolbelt. By installing third-party software on isolated environments we keep our workstations clean and healthy. By using clean environments for testing and deployments we’re less vulnerable to “It Works on My Machine” syndrome.
We differ on how to best achieve this. We use Docker, VMWare, VirtualBox, cheap VPS, disposable instances in the cloud and many other solutions.
Multipass virtual machines are fully functional Ubuntu LTS instances. Everything that can be done with Ubuntu Linux server, can be done with Multipass instances. We can run software in isolation from your workstation. We can safely play with alternative versions. We can launch multiple micro-instances running automated integration tests. We can test deployment scripts locally, before running them on higher environments. Possibilities are endless.
What are the benefits of Multipass?
How does Multipass compare to Docker, from developer’s perspective? Your mileage might vary, but for me the following benefits are important:
Multipass instance runs full uncompromised Ubuntu LTS
Everything is ready out of the box, beginning with
curl. All my familiar Linux tools are either there or one
apt install away. I can start using the newly launched instance right away, using the concepts, tools and commands I already know.
Here’s why this is important. Developer’s brain already runs on full capacity. Each time I need to learn another command, another precious childhood memory has to make room and goes down the drain, forever lost. I read that recently on The Oatmeal so it must be true ;-)
Multipass instance is connected
Immediately after launching the instance can access LAN and WAN. It is open for connections, without additional configuration. There is no need to manually configure virtual networks or map ports.
Multipass instance is persistent
Docker containers are disposable by design. Data shouldn’t be kept on them. We use shared volumes instead. This comes with limitations. For crucial security reasons, Docker allows mounting volumes only once, when container is created. But these otherwise important considerations aren’t relevant on my development machine.
mount command for mounting host folders into the instance. This can be done at any time: before starting the instance but also while it is already running.
Additionally, the primary instance mounts my home folder as
~/Home by default, so I can access my files instantly.
Multipass instance management is easy
Command syntax and options are few, and easy to memorize. With ability to execute commands and transfer files we can easily write scripts to fully automate software installation, integration tests, deployment tasks etc.
There is even UI for that
After installing Multipass on my PopOS! Linux box I saw the following in the top bar:
I want it, I want it, where can I get it?!
Multipass can be used on Linux, MacOS and Windows.
On Linux, Multipass is best installed with
snap. On Ubuntu-based distributions chances are
snap is already there, so simply run
sudo snap install multipass
and Multipass is ready to go. Otherwise install
snap daemon first, using package manager of choice.
To install it on other platforms download proper installation package from https://multipass.run/.
Multipass instances might not start if another VM software is running, such as Oracle VirtualBox. Simply stop VirtualBox and try again.
Author Tomasz Waraksa
© Tomasz Waraksa, letsdebug.it
This article is not promoting any of the described products, services or vendors. We don't have any commercial interest nor associations with them. We're not trying to suggest that these products or services are best for you, nor promising that your experience will be the same.
In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website and any information presented on it.
Through this website you are able to link to other websites which are not under our control. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.
Permission is hereby granted, free of charge, to any person obtaining a copy of software published on this website and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions, unless stated explicitly otherwise:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.