I use Arch Linux as my primary OS and I work on a web app built for Centos. Initially I was using LXC Container
in my Arch to run a Centos, however due to problems configuring Network over Wifi etc I decided to find an alternative and someone suggested that chroot
ing directly might work instead.
Currently I just use LXC
commands to create a Centos and just chroot
into it and work. I also mount the /bind
, /proc
and /sys
into my chroot
ed environment. My web app works just fine with no problems.
Are there any concerns/caveats in this approach? I still haven't tried advanced things like Java JVM
yet. I know it uses the host system's Kernel, and I guess System Calls
are backward compatible in Linux (which is why this idea works), so everything should work as seamless as you would expect.
Still I would like to know if there are scenarios where you could get into problems using chroot
? Like are there any scenarios where chroot
might not work like a normal system? Logically I can't see anything as long as Kernels are backward compatible. The one place I can think of is when the Host system's Kernel has a different implementation compared to original Kernel and if there are bugs in that which is usually unlikely.
While I use Arch, I would like to get a general perspective. My main idea is to recommend this to my colleagues who don't use Centos as their primary OS due to various reasons. There are also use cases where you need a 32-bit machine on a 64-bit. Lot of them spent a lot of time setting up VM's etc but is that really needed for a Linux on a Linux "virtualization"? I personally feel chroot
is awesome and not just a debugging tool, however I wanted to get some expert opinion.
arch-chroot
instead ofchroot
, there are "issues" with the pid namespace. You might also want to look atsystemd-nspawn
. – StrongBad Aug 30 '16 at 17:47chroot
even on Arch. For 32-bit containers I dolinux32 chroot <path-to-root>
– Nishant Aug 30 '16 at 17:53docker
- allows you to easily create containers with networking orvagrant
- to easily configure fully fledged development VMs locally. Both of these work excellently in a dev environment and you can easily share the configurations with your colleagues - they are both designed to solve the problem you have, developing an application against one distro on any other distro (even when on osx and windows with vagrant) – Michael Daffin Aug 30 '16 at 18:49chroot
does all that, isn'tDocker
an overhead?Docker
andLXC
seems to bechroot
on steroids, sharing the host kernel. I couldn't see what additional valueDocker
can bring in (I am a fan of minimalism xD), however I guess I need to research on that. OSX and Windows support with Vagrant is something that seems interesting to explore. I would be happy if I can help those users as well. – Nishant Aug 30 '16 at 19:25