Pulling an Docker Image within a chroot environment

chrootdockerraspberry pi

I am trying to create my own, custom Raspberry Pi image using Pi-Gen https://github.com/RPi-Distro/pi-gen Basically I was able to fulfill most of my requirements, but I got a problem while trying to install HomeAssistant using their install script.

As you can see in the above-mentioned git repo, Pi-Gen uses a staging system. Every stage contains scripts that get executes on the destination chroot. I already installed docker that way. For installing HomeAssistant, I have copied this script: https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh to the destination chroot. Then I executed it with this command:

Now the problem is, that inside of this install script, i try to pull a docker image into the virtual chroot environment.

This leads to this error:

[Info] Install supervisor Docker container"
time="2020-05-01T09:38:10+01:00" level=error 
msg="failure getting variant" 
error="getCPUInfo for pattern: Cpu architecture: not found"

Docker seems not to have any information about the CPU inside the chroot environment.
Is there any workaround for that problem?

Thank you

Best Answer

Before entering chroot (or running the script that enters chroot), bind the /proc directory on top of your chroot base path so docker can "see" /proc/cpuinfo on the host OS.

mount -o bind /proc ./mychrootbasepath/proc
Related Question