Is it possible to run a 10.04 or 12.04 or earlier LTS containerized under LXC or Docker on Trusty?

5,190

Solution 1

You can run older Linux programs on newer kernels. Linux maintains backward compatibility (at least for all documented interfaces), for the benefit of people who are running old binaries for one reason or another (because they don't want to bother recompiling, because they've lost the source, because this is commercial software for which they don't have the source, etc.).

If you want to have a build environment with older development tools, or even a test environment for anything that doesn't dive deeply into kernel interfaces, then you don't need to run an older kernel, just an older userland environment. For this, you don't need anything complex: a chroot will do. Something more advanced like LXC, Docker, … can be useful if you want the older (or newer, for that matter) distribution to have its own network configuration. If you don't want that, you can use what Debian uses precisely to build software in a known environment (e.g. build software for Debian stable on a machine with a testing installation): schroot. See How do I run 32-bit programs on a 64-bit Debian/Ubuntu? for a guide on setting up an alternate installation of Debian or a derivative in a chroot.

If you want to run the older distribution's kernel, you'll need an actual virtual machine for that, such as KVM or VirtualBox. Linux-on-Linux virtualization with LXC or the like runs the same kernel throughout.

Solution 2

➜ codetv_static# docker run ubuntu:10.04 /bin/echo 'Howdy!' Unable to find image 'ubuntu:10.04' locally 10.04: Pulling from library/ubuntu a3ed95caeb02: Pull complete 86b54f4b6a4e: Pull complete Digest: sha256:f6695b2d24dd2e1da0a79fa72459e33505da79939c13ce50e90675c32988ab64 Status: Downloaded newer image for ubuntu:10.04 Howdy!

Share:
5,190

Related videos on Youtube

0xC0000022L
Author by

0xC0000022L

human father bibliophile geek & ~nerd misanthropic philanthropist skeptic code necromancer programmer reverse engineer (RCE) / software archaeologist / grayhat hacker moderator on reverseengineering system administrator FLOSS enthusiast Debian, FreeBSD and Ubuntu aficionado

Updated on September 18, 2022

Comments

  • 0xC0000022L
    0xC0000022L over 1 year

    Is it possible to have a vanilla installation of Ubuntu 14.04 (Trusty) and run inside it containerized older Ubuntu versions that originally came with older kernels?

    For example for 12.04 I'd assume the answer is yes as it has linux-image packages for subsequent Ubuntu releases, such as linux-image-generic-lts-saucy and linux-image-generic-lts-quantal. For 10.04 that isn't the case, though, so I'm unsure. But is there documentation available that I can use to deduce what's okay to run?

    The reason I am asking is because the kernel interface undergoes updates every now and then. However, it's sometimes beneficial to run newer versions of the distro and at the same time keeping a build environment based on a predecessor.

    • Admin
      Admin almost 10 years
      I would simply try it out. If you happen to have access to the older 10.04 + 12.04 install media I would setup Docker images for these and try it out.
    • Admin
      Admin almost 10 years
      No need to use install media, there're several docker containers of older Ubuntu releases in the registry.
    • Admin
      Admin almost 10 years
      This mailing list thread (and the linked answer by jpetazzo) could provide some insight.
  • 0xC0000022L
    0xC0000022L almost 10 years
    I know there is a backward compatibility. But it's not so trivial, is it? Why else would linking against GLIBC leave an annotation header in ELF files stating a certain kernel ABI. Think about the move from 32bit time_t to 64bit time_t which is an incompatible change. So what's the cutoff point?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 10 years
    @0xC0000022L Linux still supports a.out binaries. Which have been obsoleted by ELF since 1998 or so. Newer Linux kernels support the older ABI; the kernel ABI indication is there because newer applications may not run on other kernels.
  • Otheus
    Otheus about 8 years
    i have the related question: how can a base installation running, say, 3.10 of the kernel, support a docker image of, say, Ubuntu based on version 4 of the kernel?