photobooth icon indicating copy to clipboard operation
photobooth copied to clipboard

feat: add Docker and docker-compose files with hardware support

Open lemmi25 opened this issue 4 months ago • 1 comments

Added Docker containerization to enable faster and easier photobooth setup. The container includes hardware support for cameras and printers, allowing users to mount the private folder for image storage and configuration (such as QR codes on the welcome screen).

Note: This image could be optimized further with a multi-stage build. This branch should serves as a starting point for Docker-based deployment with hardware.

Some Background 😉

I was celebrating a party and wanted to build my own photobox. I came across this project—it looked pretty cool! (Nice UI, and sure, we can debate about PHP or whatever... 😄) However, the installation script didn’t work very well for me, so I decided to put everything into a Docker container and run it on my local network. That way, the container could access all the peripherals (Canon 1200, Canon CP1500 printer, and an ESP32 acting as an access point).

This approach worked quite well overall, except the ESP32 would crash occasionally, and sometimes the connection to the printer was lost. But honestly, that just made the party feel more hacky and fun :)


Technical Details to Use My Setup

I use the private folder as a mount point to store all the configuration files and captured images. I placed a sample QR code I generated (the filename includes the WiFi name and password) in a designated location.

One important thing: you need to give this folder the correct permissions in order to work properly with Docker Compose. Run:

sudo chown -R 33:33 private

from the repository’s directory. 33 is the UID of www-data, which is used by Photobooth. After that, build the Docker image using:

docker build -t photobox .

This will build an image that's quite large (~1.2 GB). But hey, if you take a lot of photos at your party, that’s not so bad ;)

Next, run:

docker compose up -d

This will start Photobooth, and you can configure everything through the admin panel as you wish.


The Thing with Hardware

This is where I spent most of my time.

First, it’s important that the container runs in host network mode so it has full access to the network and USB devices on the host (in my case, a Raspberry Pi 4). My Canon 1200 Camera worked quite well—only when it went into sleep mode did it become a problem, requiring a restart. More problematic was the Canon CP1500.

The issue? The ESP32 is not a reliable access point (OK, wow). For whatever reason, I thought it was a good idea to use it (Use something like a FritzBox). Why? Because I had a QR code download access point and could also connect the printer and Pi to it. Unfortunately, the printer didn’t work over USB-C, which would have made my setup much more stable.

So when the ESP32 decided to crash or disconnect, the connection to the printer was lost—and the entire photobooth stopped working (the part were I wanted to print images).

To fix this, I created a script: configure_printer.sh inside the scripts folder. I copy and build this into the image. I’m currently downloading the master repo and building it into my container. If this becomes part of the master repo at some point, this step won’t be necessary anymore (Ore hopfully someone comes up with a better idea :D).

You need to execute this script either at the start or when the printer connection drops by entering the container:

docker exec -it <container_name_or_id> bash

Then run:

/usr/bin/bash /usr/local/bin/configure_printer.sh

If you have a printer that works over USB, this should not be an issue since the drivers are included in the image (I hope—I didn’t have other hardware to test with besides my Canon CP1500).


Things to Improve

As I mentioned at the beginning, I hope this can serve as the starting point for a Dockerized Hardware version of Photobooth.

I couldn’t test much hardware. Since the best way to test a setup is at a real party (to see if things actually work), and mine is over, maybe some of you can test this setup further and improve it.

My first ideas for improvements:

  • Test with a USB printer.
  • Optimize the Docker image size with a multi-stage build.

Outlook

Having a docker image we could serve from a registry :) . If we can create a stable image that supports multiple hardware devices (which some of you hopefully will test), my plan would be to integrate it into a Yocto image so we have a cool, bundled photobooth software setup—all included 😎


Many thanks and have a nice weekend! Moritz 😊

image

lemmi25 avatar Aug 02 '25 12:08 lemmi25

Hey and sorry for the late response!

I like the idea in general but docker is nothing I am really familiar with (yet).

I've recently fixed the installer to hopefully be fully working with Debian Trixie based images too. Maybe the issue you've run into are solved for you too.

If you like, you can join our community at telegram. I am sure there's some tester to improve your current implementation and making sure it's working on a lot of devices out of the box. It could be considered to add a build routine for latest Gutenprint driver too, depending on used hardware.

I'll watch this PR with interest, even if I am not a real helping hand on this at the moment.

Side note for myself: Needs to be documented somewhere, before committing

npm run format
npm run composer:cgl

is recommended to make sure formatting guidelines matches.

Best regards Andi

andi34 avatar Sep 13 '25 19:09 andi34

The issue? The ESP32 is not a reliable access point (OK, wow).

hint: you can use your pi wifi as a hotspot without another hardware access point.

i splitted it up to use 2.4ghz wifi for the hotspot to connect the printer and tablet to the pi and the 5ghz wifi from the pi is connected to my home wifi. but the setup was a hassle so i dont have a step-by-step guide. youll need to google and gpt your way. but it works quite well now.

i even forwarded the 2.4ghz hotspot network to the 5ghz wifi, so if i am connected to the pi hotspot with a tablet or laptop, i still have internet if the pi is connected to my 5ghz home wifi.

reloxx13 avatar Nov 25 '25 09:11 reloxx13