lxc命令简单速查

LXC 使用 cgroup 文件系统来管理容器。
在使用 LXC 之前,首先必须挂载这个文件系统:mount -t cgroup cgroup /cgroup。可以将 cgroup 文件系统挂载到任何地方。
LXC 将使用 /etc/mtab 中挂载的第一个 cgroup 文件系统。(ubuntu11.10安装libvirt之后会自动挂在到/sys/fs/cgroup,无需手工操作)
 
查看和调整容器的优先级
  1. lxc-priority -n name
  2. lxc-priority -n name -p priority
持续观察容器的状态和优先级变化:
  1. lxc-monitor -n name
 
LXC 使用 cgroup 文件系统管理容器。可以通过 LXC 读和操纵 cgroup 文件系统的一些部分。要管理每个容器对 cpu 的使用,则可以通过读取和调整容器的 cpu.shares 来进行:
  1. lxc-cgroup -n name cpu.shares
  2. lxc-cgroup -n name cpu.shares howmany
暂停和恢复
  1. lxc-freeze -n name
  2. lxc-unfreeze -n name
 
停止
停止一个容器将导致该容器中启动的所有进程全体死亡,并且清理容器:
  1. lxc-stop -n name
 
销毁
销毁容器是指删除通过 lxc-create 步骤与名称关联的配置文件和元数据:
  1. lxc-destroy -n name

 

posted @ 2013-01-12 09:47  zaleilynn  阅读(909)  评论(0编辑  收藏  举报