在 Ubuntu 上使用 LXC 创建 Alpine 容器

在 Ubuntu 上使用 LXC 创建 Alpine 容器

我启动了一台新服务器,安装了 Ubuntu Server 和 LXC 以供 apt 使用。我一直在阅读文档并试图了解如何导入图像/模板。我很难理解如何导入公共图像列表,特别是如何使用 Alpine 设置新实例。我相信这可以通过 ISO 的 tarball 来完成(来自手册页),但也有一个远程选项。

LXC 容器列表在这里:https://us.images.linuxcontainers.org/说这些可以通过 lxc-download 模板获得,我以为这是一个触发模板的命令,但现在我更加困惑了。

答案1

如果使用 LXC,通常可以使用如下命令设置新容器:

lxc-create -n ${c} -t download -- -d ${d} -r ${r} -a amd64

其中c是您选择的容器名称,d是发行版(例如“alpine”),r是发行版的版本号。以下是示例:

# lxc-create -n test -t download -- -d alpine -r 3.12 -a amd64
The cached copy has expired, re-downloading...
Setting up the GPG keyring
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
You just created an Alpinelinux 3.12 x86_64 (20201213_13:00) container.

相关内容