Install InvoiceNinja 5 as a docker image
Fast, easy and straight forward: Learn how to setup InvoiceNinja 5 as a docker image using docker compose.
What is InvoiceNinja?
InvoiceNinja is a free and open source invoicing, expense and time tracking tool. It has the following functionalities and is very easy to use:
- Invoices & Auto-Billing
- Online Payments
- Quotations & Proposals
- Streamline Workflows
- Time-Track Work
- Expenses & Reporting
How to install InvoiceNinja 5 on Docker
There are several installers you can use for InvoiceNinja 5 e.g. using it on Softacoulus. Since this is sensitive information and because of GDPR regulations I do prefer hosting these thing on my own premise (or my own cloud instance) so that I do not need to worry about third party GDPR regulations.
Docker makes sense as it brings you the whole installation packed and ready to run without making to many changes to your current system.
Installing the basics: Docker and Git
In order to get started with InvoiceNinja5 and Docker you need to install Docker and Git on your system first. This can be done as follows:
sudo apt update sudo apt install git sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
Downloading the InvoiceNinja5 source for Docker
As next step you need to download the Docker source for InvoiceNinja5. Do do this we navigate to the /var directory and then pull the source code:
cd /var sudo git clone firstname.lastname@example.org:invoiceninja/dockerfiles.git
Alternatively you can dowload the zip file and unzip it.
cd /var sudo wget https://github.com/invoiceninja/dockerfiles/archive/refs/heads/master.zip sudo unzip master.zip -d /var/dockerfiles
Next you need to generate an app key and set the permissions, which can be done with the following commands.
cd dockerfiles sudo chmod 755 docker/app/public sudo chown -R 1500:1500 docker/app docker run --rm -it invoiceninja/invoiceninja php artisan key:generate --show
Note down the app key, as you will need it later
Now edit the env file and insert your app key and you app url.
sudo vim env
Next you need to update the IPs in the docker-compose to make sure that your PDF generation is working correctly. Look for the in5.test sections in the docker compose and replace the IP there with your local IP.
sudo vim docker-compose.yml
And edit the hosts file to enter your local IP.
sudo vim config/hosts
After this you can bring up your containers and enjoy InvoiceNinja5.
docker-compose -f docker-compose.yml up -d
After this you will be able to call InvoiceNinja5 entering your IP in the browser. E.g. http://192.168.0.15/
You can also read about this here.