# Balena / Docker image from bootable sd card?

**URL:** <https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886>\
**Category:** balenaEngine\
**Created:** [September 24, 2019, 10:55pm UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886 "2019-09-24T22:55:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustyeddy](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rustyeddy](https://forums.balena.io/u/rustyeddy)\
**Post date:** [September 24, 2019, 10:55pm UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/1 "2019-09-24T22:55:26Z")

</div>

Hello,

I am a Newbie, very much appreciate the help I get!!!

The company I work for is going to start using Balena for the products it delivers, the product is a large piece of equipment with fairly complex electronics and corresponding software that uses Raspberry Pi as a “master controller”. The RPi is running Raspbian with a some of our software, and couple custom/proprietary third party drivers installed along with some udev changes and other “stuff”.

My Boss thinks we should be able to create an balena base image from this customized sd card / image to be managed by balena.

From what I have read thus far, it seems to me, we have to basically build the images as docker containers before we can have them managed by the balena eco-system.

Can somebody help clarify my confusion.

Thank Y’all very much in advance!

- Rusty Eddy

---

<div class="post-metadata">

**Author:** ![roman-mazur](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/roman-mazur/32/2194_2.png) [@roman-mazur](https://forums.balena.io/u/roman-mazur)\
**Post date:** [September 25, 2019, 9:09am UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/4 "2019-09-25T09:09:46Z")

</div>

Hello @rustyeddy

Glad you are going to become balena users and welcome to our forums!

Devices managed with balena platform run balenaOS as their operating system. The OS also includes a docker engine suited for the IoT devices (balenaEngine) which is used to deploy and run user applications on the device.

The software you currently have running on Raspbian will need to be packaged in a form of Docker images, so you can ship it to the devices with our platform. To have a quick start, I would recommend quick start guides on our docs site  
[https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/](https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/)  
or experimenting with one of our DIY projects on the blog

> **[Turn your old speakers or Hi-Fi into Bluetooth receivers with a Raspberry Pi...](https://www.balena.io/blog/turn-your-old-speakers-or-hi-fi-into-bluetooth-receivers-using-only-a-raspberry-pi/)**
>
> If you’ve got an old Hi-Fi or sound system with an AUX input, this project is for you. Try balenaSound, a starter project to quickly and easily add Bluetooth to an old Hi-Fi, speakers, or any other audio device using only a Raspberry Pi! Contents...

  
or  

> **[Make a web frame with Raspberry Pi in 30 minutes](https://www.balena.io/blog/make-a-web-frame-with-raspberry-pi-in-30-minutes/)**
>
> Try balenaDash, a simple project to quickly get you up and running with a web frame to display family photos, dashboards, videos, and more. Contents Introduction Hardware required Software required Setup of the Raspberry Pi Assembling the display and...

Packaging device drivers may be challenging though depending on their nature. For instance, if you need kernel modules, you will have to compile them against our OS header files during Docker image build and then load them in your container entry point.  
An example of how this can be done is given in the following github repo:

> **[balena-io-projects/kernel-module-build](https://github.com/balena-io-projects/kernel-module-build)**
>
> Example project for building an OOT kernel module in resin - balena-io-projects/kernel-module-build

  
(you will find scripts that fetch kernel headers for a specific balenaOS version, compile them, and load)

I would also suggest checking the following docs related to the topic of interacting with hardware from Docker containers and working with UDEV rules.

> **[Interact with hardware - Balena Documentation](https://www.balena.io/docs/learn/develop/hardware/)**
>
> Access GPIO, I2C and SPI interfaces with {{ $names.company.lower }}

Hope this helps.

---

<div class="post-metadata">

**Author:** ![rustyeddy](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rustyeddy](https://forums.balena.io/u/rustyeddy)\
**Post date:** [September 25, 2019, 3:19pm UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/6 "2019-09-25T15:19:02Z")

</div>

It does help, Thank you very much for the prompt and detailed response. I do say there are some interesting projects.

I guess, we were hoping for a magic disk to docker image translator, but alas, I realize that was just wishful thinking.

Again, thank you very much for the prompt and detailed response!

- rusty

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [September 25, 2019, 5:32pm UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/9 "2019-09-25T17:32:14Z")

</div>

Hi @rustyeddy,

We have a team at balena that specializes in these kinds of things, and I am checking in with them for more information about your usecase. In the meantime, I recommend reading this blogpost ([https://www.balena.io/blog/sonder-creating-unique-hospitality-experiences-with-balena/](https://www.balena.io/blog/sonder-creating-unique-hospitality-experiences-with-balena/)) which details a client’s brownfield migration to balenaCloud.

Thanks again for reaching out!

---

<div class="post-metadata">

**Author:** ![rustyeddy](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rustyeddy](https://forums.balena.io/u/rustyeddy)\
**Post date:** [September 25, 2019, 6:46pm UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/11 "2019-09-25T18:46:45Z")

</div>

@xginn8,

Awesome, thank you for contacting your team, we are very interested to hear what they have to say.

Also, I watched the video and will dig into the article, but I think this is very similar to our situation regarding the “Brownfield deployment”, except that we are at a much smaller scale.

Looking forward to what your team has to say!

Cheers,

- rusty

---

<div class="post-metadata">

**Author:** ![samothx](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@samothx](https://forums.balena.io/u/samothx)\
**Post date:** [September 26, 2019, 10:17am UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/13 "2019-09-26T10:17:20Z")

</div>

Hi @rustyeddy .  
I am in charge of what we call brownfield migration in balena. This is the process of taking a device in the field running on a non balena OS and turning it into a device running balena OS. The process typically involves transferring a migration environment to the device (typically about 140MB including the OS image) and running the migrator on the device with root privileges.  
The migrator has options that allow creating a backup of required data and transferring this data to the applications containers that will be running your application in balena.  
Brownfield migration does not help you migrate your application into a container and make it balena-compatible though. It just allows you to deploy balenaOS and your balena application to devices in the field running other OS’ses than balena.

Reading through this thread I believe that migrating your application might be a two step process. You mentioned custom drivers and other ‘stuff’ that you will want to run on the device.  
The first step would be to containerize your application and see how you get your software to run in containers on balena. If this is not straight forward, balena support might be able to point you in the right direction.  
First step would be to identify potentially problematic software like special device drivers and figure out how you can run them inside balena.  
There is a repository demonstrating how to add custom kernel modules to balena here: [https://github.com/balena-io-projects/kernel-module-build](https://github.com/balena-io-projects/kernel-module-build)

Once you have a balena OS image and a working application, we can set up an environment to migrate devices that are already deployed using a different OS.

---

<div class="post-metadata">

**Author:** ![rustyeddy](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rustyeddy](https://forums.balena.io/u/rustyeddy)\
**Post date:** [September 29, 2019, 1:22am UTC](https://forums.balena.io/t/balena-docker-image-from-bootable-sd-card/33886/15 "2019-09-29T01:22:07Z")

</div>

Hello @samothx, thank you for the info.

Our biggest challenge, I think is properly creating the containers around our apps is the biggest challenge. The “good news” is we are just now shipping our first actual product, so we do not have much of an existing deployment to worry about.

Our challenge is properly creating the containers ASAP such that we ship as few pre-balena units as possible…

I am sure I will be back with more, specific questions creating the containers.

One again, Your feedback is very helpful!

Thank You.

- rusty
