It works both with VirtualBox and Hyper-V on Windows, it also support MacOS including M1
Configure virtualization driver
If you want VirtualBox (works on Linux, Windows, and MacOS)
multipass set local.driver=virtualboxIf you want Hyper-V
multipass set local.driver=hypervOn MacOS M1 you probably would want to use Hyperkit
multipass set local.driver=hyperkitLaunch docker in a VM
multipass launch dockerYou can set disk, CPU, RAM limits, and name
multipass launch docker --cpus 2 --disk 40G --memory 4G --name dockerCreate alias (it may ask to update PATH environment variable)
multipass alias docker:dockerView all aliases
multipass aliasesConnect to shell
multipass shell dockerRemove alias
multipass unalias dockerList and terminate VMs
multipass list
multipass info
multipass delete dockerPurge deleted VM
multipass purgeCombine purge and delete in one command
multipass delete -p dockerList all available options
multipass --helpChange VM config, add host-only adapter
multipass stop docker
psexec64 -nobanner -s "%VBOX_MSI_INSTALL_PATH%\vboxmanage" showvminfo docker
psexec64 -nobanner -s "%VBOX_MSI_INSTALL_PATH%\vboxmanage" modifyvm docker --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter"
multipass start dockerSet netplan configuration
multipass shell dockercat <<EOF | sudo tee /etc/netplan/60-host-only.yaml > /dev/null
network:
ethernets:
enp0s8:
optional: yes
dhcp4: yes
dhcp4-overrides:
route-metric: 110
match:
macaddress: $(cat /sys/class/net/enp0s8/address)
set-name: enp0s8
dhcp6: no
version: 2
EOF
sudo netplan apply
ip addr show enp0s8What is
route-metric: 110? We don't want to put our new network interface route before the default route with metric 100.
Manage VMs in VirtualBox UI
psexec64 -nobanner -i -s "%VBOX_MSI_INSTALL_PATH%\virtualbox"PsExec can be downloaded from live.sysinternals.com
For Windows there is an alternative to psexec called gsudo
gsudo -s "%VBOX_MSI_INSTALL_PATH%\virtualbox"
gsudo -s "%VBOX_MSI_INSTALL_PATH%\vboxmanage" showvminfo docker --machinereadable | find /I "nic"Cloud-init
cat > cloud-init.yaml <<'EOF'
write_files:
- path: /etc/netplan/60-host-only.yaml
permissions: '0644'
content: |
network:
ethernets:
IFACE_NAME:
optional: yes
dhcp4: yes
dhcp4-overrides:
route-metric: 110
set-name: IFACE_NAME
dhcp6: no
version: 2
runcmd:
- 'sed -i "s/IFACE_NAME/enp0s8/g" /etc/netplan/60-host-only.yaml'
- 'netplan generate'
- 'netplan apply'
EOF
multipass launch docker --cloud-init cloud-init.yaml
On Windows