我无法使用lxc 1.0.0创建Ubuntu容器。Ubuntu 13.04上的apha1版本正在更新。有什么明显的我遗漏了吗?
root@ubuntu:~# lxc-ls --fancy
NAME STATE IPV4 IPV6 AUTOSTART
----------------------------------
root@ubuntu:~# lxc-version
lxc version: 1.0.0.alpha1
root@ubuntu:~# lxc-create -t ubuntu -n u_1
getopt: unrecognized option '--rootfs=/usr/lib/x86_64-linux-gnu/lxc'
lxc-create: container creation template for u_1 failed
lxc-create: Error creating container u_1
root@ubuntu:~#
已安装lxc 1.0.0。aplha1在Ubuntu 13.04上使用以下命令
root@ubuntu:~# apt-get install -y liblxc0/raring-backports python3-lxc/raring-backports lxc/raring-backports
Alpha版本一般不稳定。去年LXC发生了很大的变化,Ubuntu 14.04发布了LXC 1.0.5,这个命令应该可以工作:
$ lxc-create -t ubuntu -n u_1
(在目录/var/lib/lxc/u_1
中创建名为u_1
的ubuntu模板容器)
我很喜欢LXC,但我不喜欢lxc-create
。依赖脚本来生成rootfs,对我来说似乎是错误的(脚本可能会失败,它们必须被维护,等等)。Docker正在构建一个巨大的根文件系统数据库,针对容器使用进行了优化,它们可以与LXC一起使用。检查dlrootfs以避免再次使用lxc-create
。
观看Udemy的Ansible教程(我是linux newb),其中说要启动这个命令(——type ubuntu)(——name db1)
lxc-create -t ubuntu -n db1
得到这个错误:
lxc-create: db1: utils.c: get_template_path: 901 No such file or directory - bad template: Ubuntu
lxc-create: db1: lxccontainer.c: __lxcapi_create: 1798 Template "Ubuntu" not found
lxc-create: db1: tools/lxc_create.c: main: 317 Failed to create container db1
修复
sudo lxc-create -t download -n db1 -- -d ubuntu -r jammy -a amd64
你可以改变最后两个以适应你的需要。我需要jammy和amd64。
我的Ubuntu 22.04.2 (jammy)和64是在VirtualBox上。LXC版本5。从这里得到灵感ubuntu
也安装了lxd,但不知道是否有用
apt install lxd-installer