5
LXC容器和LXC WEB Panel
X edited this page 2025-04-22 15:12:30 +00:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

一、 LXC安装和使用

  • 基于ubuntu
apt -y install lxc
  • 查看内核兼容性
lxc-checkconfig
  • 使用方法
#启动容器,在母机上执行
lxc-start 容器名

#附加容器,在母机上执行,执行完后会进入容器命令行
lxc-attach 容器名

#在容器内执行,执行完成后会退出容器并回到母机,容器会继续运行
exit

#在容器内执行执行完成后会退出容器并回到母机容器会重启若要再次进入容器需要重新执行lxc-attach命令
reboot

#停止容器,在母机上执行
lxc-stop 容器名

#列出所有容器,在母机上执行
lxc-ls

#列出所有的资源开销
lxc-top

二、安装LXC_Web_Panel来管理LXC容器(仅Ubuntu)

  • 通过脚本一键安装
wget https://lxc-webpanel.github.io/tools/install.sh -O - | bash

#或者
wget https://hfs.ai-life.net:8443/chfs/shared/Scipts/install.sh -O - | bash
  • 手动安装
git clone https://gitee.com/mirrors/lxc-webpanel.git
pip install flask==0.9
python lwp.py
  • 访问项目 在浏览器输入:https://ip:5000访问项目默认用户名和密码都是admin