Some links in this post may be affiliate links. We may get paid if you buy something or take an action after clicking one of these, but without addictional costs for you compared to direct buying.

Manage your Finance with Firefly III and Raspberry PI

Raspberry PI FireFly III featured image
FireFly III logo

Having finance under control is a good way to correctly manage money and analyze what expenses can be reduced to save. Usually many internet services offer solution to manage your money, but privacy issues raised attention on data saved in cloud, so more and more people look for self hosted solutions able to grant data reside in their home. An answer to this needs is Firefly III

In this tutorial I’m going to show you how to install FireFly III with Docker in a credit card sized, cheap computer: Raspberry PI.

What is Firefly III

Firefly III, a free and open source personal finance manager, aims to get you aware where your money are spent, so that you can organize better your payments and verify where you should look if you want to make saving.

It is self-hosted, meaning that it can run on a home computer or you can alternatively find a hosting service where to install it.

Firefly III installation can be performed on Docker, Kubernetes, LAMP server or via hosting tools (like Softaculous). For this project, I’m going to use Docker procedure on Raspberry PI 3 model A+, but this guide applies also to newer Rasperry PI boards.

What We Need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continuing with the project or removing them from the shopping cart. So, hardware will be only:

Check hardware prices with following links:

Amazon Raspberry PI 3 Model A+ box
Amazon raspberry pi boards box
Amazon Micro SD box
Amazon Raspberry PI Power Supply box

Step-by-Step Procedure

Preparing Environment

Start installing Raspberry PI OS Lite.

Make your operatin system up to date, from command line:

sudo apt update -y && sudo apt upgrade -y

Then install Docker and Docker compose:

curl -fsSL -o
sudo sh
sudo usermod -aG docker pi
sudo apt install docker-compose

Reboot or reload your profile to get docker privileges to pi user.

Preparing Build and Compose Files

You will need to set your favourite values for some credentials/parameters. It is better to prepare their values from now, so that you will be ready to set them. This tutorial will include following values, so you have to change them with your ones:

  • “fireflyiiiDb” (name for database in MariaDB dedicated to your Firefly III)
  • “fireflyiiiUser” (user for database access in MariaDB)
  • “fireflyiiiPassword” (password for database access in MariaDB)

You will also need an APP_KEY, which needs to be a random string of 32 characters. This APP_KEY can be generated from your terminal with command:

head /dev/urandom | LANG=C tr -dc 'A-Za-z0-9' | head -c 32

Strart preparing the folder where files will be collected. Folder name will be used, by default, from docker compose to name container services. Create and enter it:

mkdir fireflyIII
cd fireflyIII

Folder will include following files, which I’m going to show you one by one:



This file is used to build MariaDB container from a lite debian base image. Please refer to Create custom MariaDB container article for more detailed info:

FROM debian
RUN apt update -y && apt install mariadb-server -y
RUN sed -i 's/bind-address/bind-address = #/i' /etc/mysql/mariadb.conf.d/50-server.cnf
RUN mkdir /mysql_scripts
COPY mySqlScript.sql /mysql_scripts/
RUN /etc/init.d/mysql start && mysql -uroot --password="" -e "source /mysql_scripts/mySqlScript.$
CMD /etc/init.d/mysql start && tail -f /dev/null


Also this script refers to MariaDB custom container creation. It differs from original one because the create database command is issued at start. Consider that this script will run only once at first boot during building process:

create user fireflyiiiUser@'%' identified by 'fireflyiiiPassword';
grant all privileges on fireflyiiiDb.* to fireflyiiiUser@'%';
flush privileges;


This is a mix between MariaDB compose file and Firefly III file.

# My MariaDB
# by
version: '3'
  image: jc5x/firefly-iii:latest
   - firefly_iii_upload:/var/www/firefly-iii/storage/upload
  env_file: .env
   - 80:8080
   - fireflyiiidb
  build: .
  restart: always
   - firefly_iii_db:/var/lib/mysql



env file includes all configurations needed by Firefly III service. Get .env file from FireflyIII example file and save it with correct name:

wget -O .env

Customize .env file:

nano .env

Identify and change following parameters:

APP_KEY=SomeRandomStringOf32CharsExactly -> change with your random generated APP_KEY

DB_DATABASE=firefly -> change to DB_DATABASE=fireflyiiiDb

DB_USERNAME=firefly -> change to DB_USERNAME=fireflyiiiUser

DB_PASSWORD=secret_firefly_password -> change to DB_PASSWORD=fireflyiiiPassword

You can edit or leave with default values remaining parameters.

Run Firefly III

Finally, start service by issuing following terminal command:

docker-compose up -d

Your Raspberry PI will automatically start from Debian image. It will update the base image and install MariaDB, then using sql script to initialize your database container.

Then, still automatically, it will download all FireFly III packages to initialize related container. Once finished you will have back your terminal prompt. Setup operations could continue also after containers are created, so check Firefly III web container logs with following command:

docker logs fireflyiii_fireflyiii_1

Please, note that if you used a different folder name, you will have firefly service named with folder name before underscore character. Operations should finish when this command results in something similar to following one:

Updated version.
| |
| Thank you for installing Firefly III, v5.4.2! |
| |
| |
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message
[Fri Sep 25 23:22:55.451094 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.10 configured -- resuming normal operations
[Fri Sep 25 23:22:55.451308 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

From here your FireflyIII service should be ready. In your favourite web browser, use Raspberry PI IP address (mine one is for URL. Page will be redirected to Firefly III registration URL (give more minutes in case of connection refused error and try again):

FireFly III register page

Insert your email address and choose your password (consider that your password must be at least 16 digits, include upper case, symbol, chars and number).

Then click register button. You will be redirected to Firefly III home page:

FireFly III home page

You are now ready to use your Firefly III service!

For more info and user guide, please refer to Firefly III official documentation page.

Final Operations

At procedure end, it is a good practice entering MariaDB container to change root password for security.


How useful was this post?

Click on a star to rate it anonymously!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


  1. Hi and thanks for that. Your Dockerfile contains an error : “source /mysql_scripts/mySqlScript.$ (I found the corrected version in the linked page which has more details).

    Also, when I run docker-compose up -d I am getting the following error:
    ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
    in “./docker-compose.yml”, line 2, column 8

    1. Thank you Angelos, found and corrected error in docker compose file. This is a common copy (from terminal) – paste (to editor) problem with WordPress editor which sometimes skips spaces or chars.
      I’m also going to publish files from a download area which will solve these issues.

  2. Hi Peppe!

    With this guide i was able to run Firefly III on the raspberry and use it. Unfortunatly if I try to connect from my PC to the IP of the raspberry i got a connection time out (raspberry and PC are in the same network). There are other passagges to reach this goal?

    1. Yes, if I type “localhost” from the browser on the raspberry everything is work. From my pc if I use in http the ip address of my raspberry i got a connection time out. I work from my pc in ssh so everything in the network is ok.

      I think that docker is binding only in localhost.

  3. I solved the problem.
    Basically i had to open the http port on my router (it seeems that the fastweb router has a firewall always active).

    Thank you for your guide!

  4. Unfortunately i get an error when building:
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

    I followed exactly the instructions and am using an raspberry pi 4 (4gb)

  5. I get this
    Step 2/7 : RUN apt update -y && apt install mariadb-server -y
    —> Running in e68a5c1249b4
    /bin/sh: 1: Syntax error: “&” unexpected

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept the Privacy Policy