Ubuntu VMs with multipass
Install multipass
sudo snap install multipass
# for OSX
brew install --cask multipass
Some examples
Launch a VM (by default you get the current Ubuntu LTS)
multipass launch --name foo
run a command in a running VM
multipass exec foo -- lsb_release -a
use cloud-init in your VM
multipass launch -n bar --cloud-init cloud-config.yaml
See your instances
multipass list
Stop and start instances
multipass stop foo bar
multipass start foo
Clean up what you don’t need
multipass delete bar
multipass purge
Find alternate images to launch with multipass
multipass find
Use multipass with libvirt
To use libvirt you need to
snap connect multipass:libvirt
Then you will need to switch the multipass driver
# first stop all running instances
multipass stop --all
sudo multipass set local.driver=libvirt
in case you want to swithc back your configuration
# stop all instances again
multipass stop --all
# and switch back to the qemu driver
sudo multipass set local.driver=qemu
Use Docker in OSX
To use docker on OSX you can use the docker multipass instance.
multipass launch docker
then,
multipass exec docker docker
I use a multipass alias to have docker available directly from OSX
multipass alias docker:docker
export PATH=$HOME/Library/Application Support/multipass/bin
Now you can test that everything is working fine
docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
7050e35b49f5: Pull complete
Digest: sha256:18a657d0cc1c7d0678a3fbea8b7eb4918bba25968d3e1b0adebfa71caddbc346
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/