AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 699138
Accepted
RichyHBM
RichyHBM
Asked: 2015-06-16 06:53:54 +0800 CST2015-06-16 06:53:54 +0800 CST 2015-06-16 06:53:54 +0800 CST

OpenVZ VPS 上的 LXC 容器

  • 772

我正在尝试在 OpenVZ 中托管的 VPN 上运行 LXC,我尝试过使用多种图像风格 ubuntu 来执行此操作。centos,debian ......没有运气。LXC 安装正确,但是由于网络原因容器无法启动,这似乎与接口的桥接有关!

有没有人遇到过类似的问题?有谁知道这是否是 OpenVZ 的限制?

从全新的 ubuntu 14.04 安装开始:

sudo apt-get update 
sudo apt-get install lxc
sudo lxc-create -n p1 -t ubuntu 
sudo lxc-start -n p1 --logfile log.txt
cat log.txt
    lxc-start 1434379565.265 ERROR    lxc_conf - conf.c:instantiate_veth:2949 - failed to create veth pair (vethP4LPC8 and vethO6MP73): Operation not supported
    lxc-start 1434379565.265 ERROR    lxc_conf - conf.c:lxc_create_network:3261 - failed to create netdev
    lxc-start 1434379565.265 ERROR    lxc_start - start.c:lxc_spawn:826 - failed to create the network
    lxc-start 1434379565.265 ERROR    lxc_start - start.c:__lxc_start:1080 - failed to spawn 'p1'
    lxc-start 1434379565.265 ERROR    lxc_start_ui - lxc_start.c:main:342 - The container failed to start.
    lxc-start 1434379565.265 ERROR    lxc_start_ui - lxc_start.c:main:346 - Additional information can be obtained by setting the --logfile and --logpriority options.

并尝试:

sudo brctl addbr lxcbr0
  add bridge failed: Invalid argument
openvz
  • 2 2 个回答
  • 1329 Views

2 个回答

  • Voted
  1. Best Answer
    Yonsy Solis
    2015-09-04T09:07:44+08:002015-09-04T09:07:44+08:00

    OpenVZ 是一种操作系统虚拟化技术,与 LXC 和 Docker 一样,但基于各种内核补丁,许多从未与主流内核集成。

    OpenVZ 基于旧内核(2.6.x),现在不需要很多东西来管理容器(主要是 cgroups)。不幸的是,您不能在 OpenVZ 虚拟环境中运行 LXC 容器。

    • 2
  2. grin
    2015-12-19T08:25:37+08:002015-12-19T08:25:37+08:00

    不要减少其他答案(因为他们正确地声明 OpenVZ 容器是容器),而是看到这个有趣的链接: OVZ CT 中的 Docker(“自从 OpenVZ 内核 042stab105.4 以来,可以在容器中运行 Docker。这篇文章描述了如何。” )

    它可能会或可能不会为您的问题提供一些解决方案,但理论上可以在 CT 中使用 cgroups(在比042stab105.4更新的内核上并使用相当新的vzctl)。基本上你需要:

    • 检查您的内核配置:在给定的内核下尝试lxc-checkconfig,或CONFIG=/boot/config-2.6.32-openvz-042stab108.2-amd64 lxc-checkconfig用于安装的任何内核。

    如果看起来没问题,您可以继续前进,并且:

    vzctl set $veid --save --features bridge:on --netif_add eth0 --netfilter full --devnodes net/tun:rw

    并在 CT 中挂载自定义 cgroup:

    mount -t tmpfs tmpfs /sys/fs/cgroup
    mkdir /sys/fs/cgroup/freezer,devices
    mount -t cgroup cgroup /sys/fs/cgroup/freezer,devices -o freezer,devices
    mkdir /sys/fs/cgroup/cpu,cpuacct,cpuset
    mount -t cgroup cgroup /sys/fs/cgroup/cpu,cpuacct,cpuset/ -o cpu,cpuacct,cpuset
    

    这确实是一个有趣的结构,但 ovz 控件和 cgroup 并非天生不兼容(许多 cgroup 功能是空的存根函数,例如,什么都不做,但不会发出错误消息)。

    免责声明:我还没有尝试过(我的内核缺少 cgroup 命名空间)。

    另一个有用的链接是这个 Docker 问题跟踪器评论,关于如何用所需的特性编译你的 OVZ 内核。

    • 1

相关问题

  • 对 Linux 虚拟化解决方案进行基准测试的最佳方法

  • 哪个 Apache 包最适合 mod_wsgi Django 应用程序?

  • 备份 OpenVZ 容器的最佳做法是什么?

  • 我应该选择哪些虚拟化平台,Xen 还是 OpenVZ?[关闭]

  • OpenVZ 从 NAS 迁移和故障转移?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve