1、安装
sudo apt install lxd lxd-client
查看服务状态
sudo systemctl status lxd
查看版本
lxd --version
初始化
lxd init
2、使用
查看映像服务器列表
lxc remote list
查看服务器上(ubuntu:、ubuntu-daily:、images:)虚拟机映像
lxc image list ubuntu: ubuntu官网稳定版
lxc image list ubuntu-daily: ubuntu官网每日版
lxc image list images: linux容器官网版
查看本地虚拟机
lxc image list
创建并启动myserver容器
lxc launch ubuntu:18.04 u1804
lxc launch ubuntu-daily:19.10 u1910
lxc launch images:ubuntu/bionic/amd64 u180402
容器重命令
lxc rename u1804 u1804new
查看本地linux容器
lxc list
启动/重启/停止/删除容器
lxc start/restart/stop/delete u1804
在容器中执行命令,进入容器bash shell
lxc exec u1804 -- /bin/bash
exit退出
从容器拷出文件到当前目录
lxc file pull u1804/etc/hostname /home/
复制文件到容器
lxc file push ~/a.txt u1804/root/