Is it possible to run a 32-bit LXC container (i.e. x86_32-based) on a 64-bit host (i.e. x86_64-based)?
- Does it work at all?
- What precautions may I have to take to make this work?
My kernel would be a 3.19 or newer.
Using Ubuntu Trusty 14.04, kernel: 4.2.0-36-generic #42~14.04.1-Ubuntu, lxc: 1.0.8-0ubuntu0.3 I was able to run a 32bit container in 64bit host.
Running the following cmd: lxc-create -n test -t /usr/share/lxc/templates/lxc-download
Giving these answers:
Distribution: ubuntu
Release: trusty
Architecture: i386
The config diff is very minimal: lxc.arch = x86 vs lxc.arch = x86_64
Then simply starting it per usual: lxc-start -n test
Confirmed the OS thought the arch was 32bit
root@host:~# uname -a
Linux host 4.2.0-36-generic #42~14.04.1-Ubuntu SMP Fri May 13 17:27:22 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@host:~# lxc-attach -n test
groups: cannot find name for group ID 111
root@container:~# uname -a
Linux distro 4.2.0-36-generic #42~14.04.1-Ubuntu SMP Fri May 13 17:27:22 UTC 2016 i686 GNU/Linux
I think the groups warning is something in my setup, either way it works!
There is a note in the Wiki to use linux32 to emulate 32bit. I don't think its needed.
linux32 lxc-create -n myvm -t debian-wheezy
lxc launch images:debian/buster/i386