Now that you have installed multipass success on Either Liux, Windows or macOS We are going to learn how to work with instances. This is not a complete how to It's just a quick primer on how to use Multipass.
How to Launching your first instance
After having successfully installed it, the
multipass command line utility is your main entry point.
$ multipass launch … Launched: keen-yak
launch command you see above creates a new Ubuntu instance using the default, at this point in time, image. It’s most likely going to be the latest cloud image of the newest Ubuntu LTS (Long Term Support) release. You can also choose another image, use
find to see what’s available.
It will use a catchy name for you, but you can use the
--name option to give it a name of your own. As is usual, you can pass
--help to see all the available options.
How to Execute Multipass commands
There are a couple ways you can access the instance:
sh for short), which will execute the given command directly, or open a shell inside the instance, respectively:
$ multipass exec keen-yak -- lsb_release --description Description: Ubuntu 18.04.1 LTS
$ multipass shell keen-yak Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64) … multipass@keen-yak:~$
-- passed to the
exec command - use it to separate the options passed to
multipass from those passed to the command being executed.
From there you can work inside your instance as with any other Ubuntu installation. To install software, use
apt, both are available.
Getting more information from Multipass
To get some information about your instances, you can
list them (
ls for short):
$ multipass ls Name State IPv4 Release keen-yak RUNNING 10.140.94.253 Ubuntu 18.04 LTS snapcraft-multipass STOPPED -- Ubuntu Snapcraft builder for Core 16
Or you can ask for an extended status report:
$ multipass info keen-yak Name: keen-yak State: RUNNING IPv4: 10.140.94.253 Release: Ubuntu 18.04.1 LTS Image hash: d53116c67a41 (Ubuntu 18.04 LTS) Load: 0.00 0.12 0.18 Disk usage: 1.1G out of 4.7G Memory usage: 71.6M out of 985.4M
How to Share data with a Multipass instance
he recommended way to share data between your host and the instance is the
$ multipass mount $HOME keen-yak $ multipass info keen-yak … Mounts: /home/ubuntu => /home/ubuntu
From this point on
/home/ubuntu will be available inside the instance. Use
umount to unmount it again and you can change the target by passing it after the instance name:
$ multipass umount keen-yak $ multipass mount $HOME keen-yak:/some/path $ multipass info keen-yak … Mounts: /home/michal => /some/path
You can also use
copy-files to just copy files around - prefix the path with
<name>: if it’s inside an instance:
$ multipass copy-files keen-yak:/etc/crontab keen-yak:/etc/fstab . $ ls -l crontab fstab -rw-r--r-- 1 ubuntu ubuntu 722 Oct 18 12:13 crontab -rw-r--r-- 1 ubuntu ubuntu 82 Oct 18 12:13 fstab $ multipass copy-files crontab fstab keen-yak: $ multipass exec keen-yak -- ls -l crontab fstab -rw-rw-r-- 1 multipass multipass 722 Oct 18 12:14 crontab -rw-rw-r-- 1 multipass multipass 82 Oct 18 12:14 fstab
How to Delete a Multipass instance
When you’re done with it, you can
delete the instance:
$ multipass delete keen-yak
You will see in
list that it’s actually just marked for deletion (or to put it in other words, put in the Recycle bin):
$ multipass list Name State IPv4 Release keen-yak DELETED -- Not Available
You can then
recover it, or
purge to remove all deleted instances completely:
$ multipass recover keen-yak $ multipass list Name State IPv4 Release keen-yak STOPPED -- Ubuntu 18.04 LTS $ multipass delete keen-yak $ multipass purge $ multipass ls No instances found.