August 23rd, 2024

Pi-CI – A RasPi 5 emulator in a Docker image for creating and flashing configs

The PI-CI project is a Docker-based emulator for Raspberry Pi configurations, supporting models 3, 4, and 5. It enables automation with Ansible and emphasizes security and backup practices.

Read original articleLink Icon
Pi-CI – A RasPi 5 emulator in a Docker image for creating and flashing configs

The PI-CI project is a Docker-based Raspberry Pi emulator aimed at simplifying the preparation and flashing of Raspberry Pi configurations for developers. It allows users to run a virtual machine (VM) that can preconfigure Raspberry Pi servers for first boot, create reproducible server configurations with Ansible, automate configuration distribution through continuous integration (CI) pipelines, and test ARM applications in a virtualized setting. The emulator supports Raspberry Pi models 3, 4, and 5 and includes a 64-bit version of Raspberry Pi OS (Bookworm). Users can access the internet without requiring root privileges, and the setup is designed to be safe and reproducible from source. To utilize the emulator, developers can pull the Docker image and execute commands to start the VM, save images, enable SSH access, resize images, and flash them to devices. The project also facilitates automation through Ansible, allowing programmatic control over VM operations. Users are advised to back up images before making changes and to implement security measures such as setting a root password and disabling root login. The project is licensed under GPLv3, and further instructions are available on its GitHub repository.

- The PI-CI project is a Docker-based emulator for Raspberry Pi configurations.

- It supports Raspberry Pi models 3, 4, and 5 with a 64-bit OS.

- Automation is possible using Ansible for configuration management.

- Users should back up images and secure root access for safety.

- The project is licensed under GPLv3 and has detailed instructions on GitHub.

Link Icon 7 comments
By @TechSquidTV - 8 months
Super interesting! Thank you for this. I was working on a hardware project that this probably would have helped a lot with. I was writing some python but the package couldn't be compiled on my local machine so I had to run a dev server off my pi directly. I wonder if this can help.
By @hhh - 8 months
This is awesome, I've had a need for this for quite a while, and had cooked up something similar before, but will probably swap to using this.
By @franga2000 - 8 months
This is exactly what I was trying to do a few months ago, but all the RPi VMs I found were a pain in the ass and I never got it to work. Ansible deployments are conveniently but take forever on RPi, golden images are great for distribution but suck to make. Using Ansible to deploy to a VM and then exporting that image for flashing is the best of both approaches.
By @retrodaredevil - 8 months
This seems similar to https://github.com/solo-io/packer-plugin-arm-image

I believe that can also work in non-RPi images, but I didn't get very far in the Pi-CI docs so maybe that does too.

By @PowerfulWizard - 8 months
This looks useful, I usually use guestfish to put files into the image before flashing but this could be a lot more flexible.
By @nottorp - 8 months
Neat!

> The default image is 2 gigabytes in size. This can be increased (but not decreased!) through the resize command.

Is this the smallest size of an industrial SD card these days?

By @fragmede - 8 months
how does this compare to gokrazy?