【问题标题】:Unable to create lxc container on centos "lxc_container: utils.c: get_template_path: 1128 No such file or directory - bad template: centos"无法在 centos 上创建 lxc 容器 “lxc_container: utils.c: get_template_path: 1128 No such file or directory - bad template: centos”
【发布时间】:2016-02-03 22:52:27
【问题描述】:

我正在尝试在 centos 上创建一个 lxc 容器,但我遇到了以下错误: [user@sdn3-lnx-01 ~]$ lxc-create -t​​ centos -n container1

lxc_container: utils.c: get_template_path: 1128 没有这样的文件或目录 - 错误的模板:centos

lxc_container: lxccontainer.c: lxcapi_create: 1223 bad template: centos

lxc_container: lxc_create.c: main: 274 创建容器container1时出错

[user@sdn3-lnx-01 ~]$

你能帮帮我吗?

【问题讨论】:

  • 我不知道如何将多个答案标记为准确。我缺少 lxc 模板,所以我安装了它们。然后我应该使用带有 -t 选项的绝对路径。谢谢@fat_cheng 和@ Diego Mora Cespedes。

标签: centos containers lxc


【解决方案1】:

我不熟悉centos,但在ubuntu上,我遇到了同样的问题。我用execute修复它:

sudo apt-get install lxc lxctl lxc-templates

也许你需要安装更多的包。

【讨论】:

  • 要获得 LXC、LXC 文档、额外的 LXC 工具和默认的 LXC 模板,只需安装以下软件包。模板作为 shell 脚本存储在 /usr/share/lxc/templates 。 dnf install lxc lxc-doc lxc-extra lxc-templates
【解决方案2】:

你可以试试

lxc-create -n ct1 -t download

& 它将为您提供一个交互式解决方案来创建容器以及支持的模板和分发列表

【讨论】:

  • 在互联网上筛选了很多页面之后,这个解决方案终于对我有用。我的主机操作系统 - RedHat 7.7,我试图下载 LXC - CentOS 7 amb64。工作。
【解决方案3】:

试试:

lxc-create -n container-name -t /etc/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/

你也可以试试:

lxc-create -n container-name -t /usr/share/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/

基本上,检查哪个文件夹包含您的模板,/etc/lxc/templates//usr/share/lxc/templates/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    • 2016-01-05
    • 2016-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多