Using Docker to develop LedgerSMB

Submitted by freelock on Sat, 01/14/2017 - 09:38

Getting all the development dependencies and a working copy for LedgerSMB can be time consuming and complex. However, using our Docker Compose infrastructure reduces this to four simple steps:

  1. Install Docker
  2. Install Docker Compose
  3. Clone the LedgerSMB repository from GitHub
  4. Clone the LedgerSMB Development Docker repository from GitHub

(And start the infrastructure from the docker compose file.)


The example below works on Debian Stretch:

Install Docker

$ sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
$ curl -fsSL$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
$ sudo add-apt-repository \
   "deb [arch=amd64]$(. /etc/os-release; echo "$ID") \
   $(lsb_release -cs) \
$ sudo apt-get update
$ sudo apt-get install docker-ce

Install Docker Compose

Check the latest release at (and replace 1.17.0 with it)

$ sudo curl -L`uname -s`-`uname -m` \
            -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

Install docker compose bash completion (optional)

$ sudo curl -L \
              -o /etc/bash_completion.d/docker-compose

Clone the LedgerSMB repository from GitHub (checks out 'master' branch)

$ git clone ledgersmb
$ git submodule update --init --recursive

Clone the LedgerSMB Development Docker repository from GitHub

$ git clone lsmb-dev-docker

Pull the latest infrastructure from Docker Hub using Docker Compose

$ LSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml pull


At this point you are set up to start developing and testing LedgerSMB; in order to test your changes in a running LedgerSMB instance, run:

$ cd ledgersmb
$ lSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml up -d

This command starts the container infrastructure (using the names "lsmb-master-devel" and "postgres-lsmb-master-devel" for the LedgerSMB and PostgreSQL containers respectively), taking the sources in the current directory (ledgersmb) to run the application.


File permissions

You may run into problems with file permissions if you want to run commands inside the containers which try to modify your local repository. You will need to either recursively set the file ownership to this user in your local tree, assign liberal 0777 (directory) and 0666 (file) permissions or execute the commands inside the container as root.

Example using www-data user, after you fix your file permissions:

docker exec -ti lsmb-master-devel bash
www-data@90451823cb57:/srv/ledgersmb$ make dojo

Example using root inside the container:

docker exec -ti --user=root lsmb-master-devel bash

Cache issues

The container is set up with template caching enabled. This means that you'll need to restart the container after code changes to see them. This is a simple:

$ LSMB_DEV_VERSION=master docker-compose -f ../lsmb-dev-docker/docker-compose.yml restart

Supported versions

At the time of writing (November 2017), the development container infrastructure only supports development of 1.5 and never versions of LedgerSMB.


Operating system
FAQ Category

Hi Yuri,

You're probably better off using the production level Docker images (tagged 1.5) to run your LedgerSMB than running the development setup, unless you want to start developing the software itself (which we would highly welcome and appreciate!). In any case, you probably shouldn't be exposing development level code on the internet.

That said, I'm using our nginx example reverse proxy configuration (with SSL certificates from letsencrypt/certbot) to forward traffic from my public IP and "https port" to the internal Docker address. If you want to find out what the IP address of your docker image is:

$ docker inspect <your-container-name> | grep -i ipaddress
        "SecondaryIPAddresses": null,
        "IPAddress": "",
                "IPAddress": "",

which means that this bit from the proxy configuration file:

location @starman {
    # If you changed the port in the Starman service file, change it here too
   proxy_pass http://localhost:5762;
   proxy_set_header Host $host;


location @starman {
    # If you changed the port in the Starman service file, change it here too
   proxy_set_header Host $host;