Incus

一、基础要求

操作系统:Debian 13

二、安装

$ sudo apt update
$ sudo apt install -y incus

三、使用

3.1 查看列表

$ sudo incus list

3.2 创建一个容器

$ sudo incus launch images:ubuntu/24.04 first

3.3 拷贝容器

$ sudo incus copy first second

3.4 创建一个虚拟机

$ sudo incus launch images:debian/12 debian --vm

3.5 启动

$ sudo incus start first

3.6 停止

$ sudo incus stop first

3.7 查看信息

$ sudo incus info first

3.8 删除

$ sudo incus delete first

3.9 进入执行命令

$ sudo incus exec first -- bash
$ sudo incus exec first -- free -m

四、常见问题

4.1 No root device could be found

报错信息:

Error: Failed instance creation: Failed creating instance record: Failed initializing instance: Failed getting root disk: No root device could be found

解决方法:

$ sudo incus storage create default dir
$ sudo incus profile device add default root disk path=/ pool=default

验证:

$ sudo incus profile show default

期望输出:

$ sudo incus profile show default
config: {}
description: Default Incus profile
devices:
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []
project: default

4.2 doesn’t have any network attached to it

报错信息:

The instance you are starting doesn't have any network attached to it.
  To create a new network, use: incus network create
  To attach a network to an instance, use: incus network attach

解决方法:

$ sudo incus network create incusbr0
$ sudo incus profile device add default eth0 nic network=incusbr0 name=eth0

验证方法:

$ sudo incus profile show default

期望输出:

$ sudo incus profile show default
config: {}
description: Default Incus profile
devices:
  eth0:
    name: eth0
    network: incusbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []
project: default

附录一、Debian 13 下一键安装并配置

$ sudo apt update && \
  sudo apt install -y incus && \
  sudo incus storage create default dir && \
  sudo incus profile device add default root disk path=/ pool=default && \
  sudo incus network create incusbr0 && \
  sudo incus profile device add default eth0 nic network=incusbr0 name=eth0 && \
  sudo incus profile show default
Author: ismdeep
License: Copyright (c) 2025 CC-BY-NC-4.0 LICENSE