Docker on Buildroot - cu-ecen-aeld/buildroot-assignments-base GitHub Wiki
This page describes how to setup Docker on Buildroot. A working example for Raspberry Pi can be found at this pull request
- Add docker components to your image
- docker-engine
- Requires changing toolchain from rpi default to glibc
- docker-cli
- ca-certificate
- Docker daemon requires ssl certificates to fetch images from docker-hub.
- ntp
- docker daemon will give an error due to the date set as Jan 1, 1970, 00:00:00. This package helps avoid setting the date every time on start-up.
- bash
- require bash shell to run the check-config.sh mentioned in the following steps
- docker-engine
- Increase default rootfs size
- 128M default for RPI is too small for docker components. 500M is sufficient, but since there will be multiple images downloaded to the system memory, 1024M will be suitable for that purpose. Also, in case you intend to run python applications in your containers, set the rootfs size greater than 1024MB as python dependencies take up a lot of memory.
- Boot new sdcard image on target
- Load configs module using command
modprobe configs
. Usecheck-config.sh
script loaded in/bin/
using rootfs overlay to look for missing kernel configurations (see build/docker-engine*/contrib/check-config.sh)
If you get an error saying "cannot find kernel config", make sure you have access enabled to .config through /proc/config.gz" (IKCONFIG_PROC) in make linux-menuconfig, and use modprobe configs to load the modules. On running check-config.sh. - Modify buildroot to use a custom kernel configuration file and set path to your base external. This option is available in menuconfig. Use
make menuconfig
to open it and look for 'Kernel Configuration' under 'Kernel' tab, set that to 'using a custom defconfig file' and also add the path to file. (suggestion:../base_external/configs/aesd_*platform*_linux_defconfig
). - Save default configs using ./save_config.sh
- Commit modified configuration files for baseline
- Use buildroot linux-menuconfig to enable kernel configurations found by check-config.sh.
If you face an error related to cgroupfs, add this script to run on boot - Re-save modified configurations using ./save_config.sh
- Build with new kernel and test on hardware.
- Ensure that you have enabled all the mandatory packages listed by
check_config.sh
(It should work even if few packages related to memory compression under 'Storage Driver' are missing). - Verify docker hello world works on your platform. Use
docker run hello-world
. (Make sure that your platform is connected to internet so that it can download this example in case its not already loaded)