Create your own custom RetroPie image

Introduction

Building your own custom RetroPie image can be really slow, so I created a simpler way to do it using Docker and bash scripts - introducing docker-build-retropie-image!

Why

Creating custom prebuilt images was becoming painful. I would burn the base RetroPie image to my sdcard, then I would copy any roms or BIOS over. Afterwards I would take my sdcard back and make a backup of it which created a new image I could then reuse.

Solution

So now this is my new automated flow with Docker and bash scripts:

  1. Download RetroPie image zip
  2. Extract RetroPie image
  3. Resize image to the size in GB of roms + BIOS files
  4. Mount image file so files can be copied to it
  5. Copy roms + BIOS files into image
  6. Unmount image file, its now ready for burning to an sdcard

Now the whole process is fast and simple! The solution is using Docker too so it works with MacOS, Windows and Linux.

See the docker installation guide for help installing it.

Issues

Whilst testing with Docker for Mac, deleted files from the ./images volume were seemingly gone from both Mac and the Docker container... but not really!

For example I do rm ./images/retropie-4.1-rpi2_rpi3.img in MacOS and then in the Docker container I do ls -al /workspace/images/retropie-4.1-rpi2_rpi3.img and I see this:

-rw-r--r-- 0 root root 10737418240 Mar  5 21:36 /workspace/images/retropie-4.1-rpi2_rpi3.img

Why!? I should see No such file or directory instead. It might have something to do with Docker for Mac's limitations but currently I have no workaround for this.

Conclusion

Try this new flow out for yourself, I found I spent a lot less time copying over everything manually via SSH or USB. Now I can spend more time on getting my custom RetroPie image correct and rebuilding it very easily.

Find the GitHub project here: docker-build-retropie-image