Multipass 介绍

发布时间: 更新时间: 总字数:720 阅读时间:2m 作者: 分享 复制网址

Multipass 是一款支持在 LinuxWindowsMacOS 上运行的轻量级虚拟机管理器。它在 Linux 上通过 KVM、在 Windows 上通过 Hyper-V、在 MacOS 上通过 HyperKit 运行虚拟机。

HyperKit 介绍

HyperKit 是一个具有 hyperisor 能力的工具集。


Mac 上有多种方式:

  • Dockermultipass 均依赖 HyperKit,安装他们会默认安装 HyperKit
  • 源码编译 HyperKit 安装

安装 multipass

brew install multipass


$ multipass --help
Usage: multipass [options] <command>
Create, control and connect to Ubuntu instances.

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

  -h, --help     Displays help on commandline options.
  --help-all     Displays help including Qt specific options.
  -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
  networks  List available network interfaces
  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


multipass help launch
Usage: multipass launch [options] [[<remote:>]<image> | <url>]
Create and start a new instance.

  -h, --help           Display this help
  -v, --verbose        Increase logging verbosity, repeat up to three times for
                       more detail
  -c, --cpus <cpus>    Number of CPUs to allocate
  -d, --disk <disk>    Disk space to allocate. Positive integers, in bytes, or
                       with K, M, G suffix. Minimum: 512M.
  -m, --mem <mem>      Amount of memory to allocate. Positive integers, in
                       bytes, or with K, M, G suffix. Mimimum: 128M.
  -n, --name <name>    Name for the instance
  --cloud-init <file>  Path to a user-data cloud-init configuration, or '-' for

  image                Optional image to launch. If omitted, then the default
                       Ubuntu LTS will be used.
                       <remote> can be either ‘release’ or ‘daily‘. If <remote>
                       is omitted, ‘release’ will be used.
                       <image> can be a partial image hash or an Ubuntu release
                       version, codename or alias.
                       <url> is a custom image URL that is in http://, https://,
                       or file:// format.
multipass launch -c 1 -d 5G -m 256m -n nginx


  • -n : 指定启动实例名字
  • -c : 分配 CPU 数量
  • -d : 设置磁盘容量
  • -m : 设置内存容量


ubuntu@nginx:~$ . /etc/os-release
ubuntu@nginx:~$ echo "deb${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
ubuntu@nginx:~$ echo "deb${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
ubuntu@nginx:~$ curl -L${VERSION_ID}/Release.key | sudo apt-key add -
ubuntu@nginx:~$ sudo apt-get update
ubuntu@nginx:~$ sudo apt-get -y upgrade
  • 常用命令
# 查看
multipass list

# 登录 shell
multipass shell <podman-name>


ubuntu@nginx:~$ sudo apt install nginx -y
  • 挂载盘,在宿主机执行:
multipass mount /Users/xiexianbin/work/code/ nginx:/var/www/html

multipass unmount nginx
  • 传文件
$ multipass transfer nginx:/home/ubuntu/
transfer failed: [sftp push] open failed: 'SFTP server: Failure'

错误原因:位置不对,/home/ubuntu/ 不是sftp的共享目录,可以临时放到 /tmp/ 目录下在从系统内移动到合适的位置

Home Archives Categories Tags Statistics