我当时认为64位主机可以启动32位LXC,因为我们可以选择在创建LXC时指定arch.
hostmc$> lxc-create -n ubuntu -t ubuntu -- i386
主机:
hostmc$> uname -a Linux D 3.11.0-26-generic #45~precise1-Ubuntu SMP Tue Jul 15 04:02:35 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
但是然后登录到32位LXC容器时,我发现uname -a将arch指定为x86_64,甚至运行文件命令也将arch指定为x86_64而不是i386
hostmc$> lxc-console -n ubuntu
ubuntu@ubuntu:~$uname -a
Linux ubuntu 3.11.0-26-generic #45~precise1-Ubuntu SMP Tue Jul 15 04:02:35 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ubuntu:~$file /bin/ls
/bin/ls: ELF 64-bit LSB executable,x86-64,version 1 (SYSV),dynamically linked (uses shared libs),for GNU/Linux 2.6.24,BuildID[sha1]=0x37cdd635587f519989044055623abff939002027,stripped
最佳答案
在我的Debian 8.2(jessie)上,我得到:
root@srv1:~# uname -a
Linux srv1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux
root@srv1:~# lxc-create -n vm -t debian --dir /data/vm -- -a i386
...
root@srv1:~# lxc-start -n vm
...
(in the VM)
root@vm:~# uname -a
Linux vm 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
您的示例的主要区别是-a标志.