Ælex Ælex - 1 year ago 136
Linux Question

creating a docker container from a rootfs

I am dealing with the following issue:

A robot has an old Gentoo OS:

Linux bob #1 SMP PREEMPT RT Thu Aug 27 21:42:34 CEST 2015

The problem:

  1. I am trying to build a toolchain for this robot, so that I can compile new apps using gcc/g++ 4.9 or later.

  2. The robot doesn't support this and there is limited space.

  3. I tried setting RPATH to copy newer library versions but there is simply too many problems involved, it didn't work and the only solution was static linking.

  4. It seems to me that I need to build apps by creating a rootfs from the robot.

So I
the entire robot OS to my computer.
Now I want to build a docker image, so that I can use it to build gcc/g++ from scratch without the Robot's limitations (it has an
Intel(R) Atom(TM) CPU Z530 @ 1.60GHz
, 1Gb of RAM and only 29Mb of hard disk available).

  • I copied with rsync and kept all attributes, ownership and such.

  • The rootfs is at

  • I know that I need to run as root
    docker -t someorg/somename /home/alexrootfs

My questions are (treat me as a noob to docker):

  • I need to run under a i686 OS/KVM since that is what the robot OS runs under?

  • I need to set some specifics in a
    inside the rootfs (e.g.

Are there any other hints, tips or issues from somebody who has done this before?
I want to use docker and not chroot since this eventually should be part of an automated tool for building apps for the robot but built on other machines.

Many thanks in advance!

Answer Source

You will need to run docker on the same architecture as the robot, yes.

If you already have a full rootfs, the Dockerfile would look something like this:

FROM scratch
ADD . /

and you would build using

docker -t someorg/somename /home/alex/rootfs/
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download