如何在LXD中列出VM镜像(Linux容器)
时间:2020-01-09 10:39:30 来源:igfitidea点击:
在Ubuntu Linux serer上如何列出所有可用于安装在LXD镜像存储中的VM镜像?
是否可以使用lxc命令行列出lxd镜像?
lxd是系统范围的守护程序,而lxd是与lxd守护程序通信的命令行客户端。
因此,您需要使用lxc命令列出LXD存储中的镜像。
本教程将学习如何使用lxc列出LXD中的VM镜像。
如何在LXD中列出VM镜像
列出所有VM镜像语法为:
lxc image list images:
您可以使用grep命令或更多命令,如下所示:
lxc image list images: | more lxc image list images: | grep -i 'debian' lxc image list images: | grep -i 'opensuse'
您可以按如下所示应用过滤器,以仅显示Alpine Linux vm镜像:
lxc image list images: 'alpine' lxc image list images: 'opensuse'
您现在可以按照以下方式创建VM:
lxc launch images:alpine/3.8/amd64 alpine-www lxc launch images:centos/7/amd64 cenots-db lxc launch images:opensuse/15.0/amd64 opensuse-15 lxc list
如何获得Linux发行版列表?
运行以下grep命令/egrep命令,awk命令和sed命令的组合:
lxc image list images: |\ awk -F'|' '{ print }' |\ sed '/^[[:space:]]*$/d' |\ awk -F'/' '{ print "/" }' | sort | uniq | egrep -v 'more|ALIAS'
获取有关镜像选项的帮助
执行以下命令:
lxc image help
输出示例:
Description: Manage images In LXD containers are created from images. Those images were themselves either generated from an existing container or downloaded from an image server. When using remote images, LXD will automatically cache images for you and remove them upon expiration. The image unique identifier is the hash (sha-256) of its representation as a compressed tar包 (or for split images, the concatenation of the metadata and rootfs tar包s). Images can be referenced by their full hash, shortest unique partial hash or alias name (if one is set). Usage: lxc image [command] Available Commands: alias Manage image aliases copy Copy images between servers delete Delete images edit Edit image properties export Export and download images import Import images into the image store info Show useful information about images list List images refresh Refresh images show Show image properties Global Flags: --debug Show all debug messages --force-local Force using the local unix socket -h, --help Print help --project string Override the source project -q, --quiet Don't show progress information -v, --verbose Show all information messages --version Print version number Use "lxc image [command] --help" for more information about a command.