下面是LXD2.0的一些常用命令,本文会长期更新,文中算是集合了本人常用的一些命令
# ubuntu版本
sudo lsb_release -a
# 初始化配置 Initial configuration
sudo lxd init
# 创建ubuntu容器样例
lxc launch ubuntu:16.04 first
# 显示可用镜像
lxc image list images: | less
lxc image list images: 'centos'
# LXD/LXC 2.0使用清华镜像加速的方法:
创建一个remote链接,指向镜像站即可,或替换掉默认的images链接。
lxc remote add tuna-images https://mirrors.tuna.tsinghua.edu.cn/lxc-images/ --protocol=simplestreams --public
# 显示可用清华镜像
lxc image list tuna-images:
# 显示当前远程可用
lxc remote list
# 显示容器网络
lxc network show lxdbr0
# 显示容器
lxc list
# 运行容器bash
lxc exec first -- /bin/bash
# 直接运行容器命令
lxc exec first -- apt-get update
# 文件传输下载
lxc file pull first/etc/hosts .
# 文件传输上传
lxc file push hosts first/tmp/
# 停止容器
lxc stop first
# 删除容器
lxc delete first
# 显示容器信息
lxc info first
# 本地配置
lxc config edit <container>
# 显示容器详细信息
lxc config show first
lxc config show <container>
# 内存查看 free -m
lxc exec first -- free -m
# 设置内存最大值
lxc config set first limits.memory 2048MB
# 执行升级
lxc exec first -- apt-get update
lxc exec first -- apt-get dist-upgrade -y
lxc exec first -- apt-get autoremove --purge -y
# 暂停
lxc pause <container>
# 快照 Snapshots -stateful选项包含所有状态
lxc snapshot first clean
# 列出所有的快照
lxc info <container>
lxc snapshot <container> <snapshot name>
# 快照恢复
lxc restore first clean
# 从快照生成容器镜像
lxc publish first/clean --alias clean-ubuntu
# 启动快照容器镜像
lxc launch clean-ubuntu second
# 删除容器镜像方式一
lxc delete --force second
# 删除容器镜像方式二
lxc delete -f second
# 删除一个快照
lxc delete <container>/<snapshot name>
# 从快照中创建一个新的容器
lxc copy <source container>/<snapshot name> <destination container>
# 给快照重命名
lxc move <container>/<snapshot name> <container>/<new snapshot name>
# lxc运行docker
lxc config set first security.nesting true
lxc restart first
# 本地镜像导出
lxc publish ${HOST}/auto-backup --alias ${BACKUP_NAME}
lxc image list
lxc image export ${BACKUP_NAME} ${BACKUP_DIR}/${BACKUP_NAME}
# 本地镜像删除
lxc image delete <container>





最新评论
博主好,路过留言交流一下~我在做源头中转 Twinkle Model(利益相关):GPT 1折、国模 1折(GLM/DeepSeek/Kimi)、满血 Claude,低价稳定。价格全在模型广场 https://big-model.smart-agi.com/model-plaza ,有兴趣可以看看。
博主分享的 Surge 增强模式接管应用分流思路很赞!确实,系统大版本升级后,老牌 Proxifier 由于底层驱动兼容性问题经常莫名崩溃。在 Mac 上有 Surge 这种神器接管,但是在 Windows 平台上,很多人又很难找到兼顾‘轻量分流+稳定不崩溃’的工具:ProxiFyre 依赖 WireSock 内核驱动容易蓝屏且纯命令行,开 TUN 虚拟网卡又会把开发网段和公司 VPN 改乱。 如果是 Windows 用户寻找 Proxifier 替代品,非常推荐关注 Ghost Proxifier Pro: - 纯用户态 Winsock API Hook:完全免安装内核驱动和虚拟网卡,零蓝屏隐患,不改动系统默认网关与路由表; - 智能递归子进程树:很多现代客户端(如播放器、流媒体套件、IDE)会派生子进程,它能自动递归识别并接管流量,杜绝漏代理; - 现代 Fluent 图形界面:直接拖入目标 exe 即可一键绑定 SOCKS5/HTTP 节点,比老版配置规则直观很多。 注:该工具为非开源的独立客户端软件。 - 官网主页:https://ghostproxifier.com - 项目发布:https://github.com/liliBestCoder/ghost-proxifier-pro
曾经最爱之一,还有emlog,zblog
感谢分享经验,谢谢站长!!已收藏
牛牛牛
同样
站长您好,亚马逊云咨询推广资源,望建立联系,可邮件,谢谢。
换友情链接吗?