jsreport/jsreport image is automatically pushed with adequate tags into docker hub public repository in two variations:
jsreport/jsreport:2.6.1
(Dockerfile) contains default installation from npmjsreport/jsreport:2.6.1-full
(Dockerfile) contains default installation plus all the community extensions including wkhtmltopdf or electron recipes
You can find the list of all available tags and previous versions here
- Install Docker
sudo docker run -p 80:5488 jsreport/jsreport:2.6.1
This is the most basic usage. It will start jsreport server on port 80 directly in the current shell with data and configuration stored directly in container. Change 80 http port to whatever you want.
You may want to additionally run the container as daemon and restart it on system reboot
sudo docker run -d -p 80:5488 --restart always jsreport/jsreport:2.6.1
The easiest way is to pass the configuration as environment variables. The authentication can be for example applied in this way
sudo docker run -e "extensions_authentication_admin_username=admin" -e "extensions_authentication_admin_password=xxx" -e "extensions_authentication_cookieSession_secret=yyylong" -p 80:5488 jsreport/jsreport:2.6.1
Notice that _
is used as a separator for nested configuration properties. This works usually better in docker environments than also supported :
separator.
The templates are by default persisted inside the container. You may rather want to store them in a mounted directory or in an external database.
To mount directory with data you need to create directory /jsreport-home
first, make sure user running docker has permissions for it, and then run docker as
sudo docker run -p 80:5488 -v /jsreport-home:/jsreport jsreport/jsreport:2.6.1
Note that you can also create jsreport.config.json
inside the mounted directory and reconfigure jsreport before starting it.
You can apply your license key into the jsreport container using one of the following methods:
- passing the license key value through an env var
sudo docker run -e "license-key=xxyour-key-herexx" -p 80:5488 jsreport/jsreport:2.6.1
orsudo docker run -e "licenseKey=xxyour-key-herexx" -p 80:5488 jsreport/jsreport:2.6.1
- put a
license-key.txt
file with your key inside the data folder of mounted directory. Ex: if your mounted directory is located at/jsreport-home
then you can put your license key at/jsreport-home/data/license-key.txt
and then start the container normally.
The full image like jsreport/jsreport:2.6.1-full
has all the custom data stores like mongodb, mssql or PostgreSQL already installed. You only need to properly configure the store
environment variable. For example
sudo docker run -e "store_provider=mssql" -e "extensions_mssqlStore_uri=Server=tcp:jsreport.database.windows.net,1433;Initial Catalog=jsreport;Persist Security Info=False;User ID=myuser;Password=password;MultipleActiveResultSets=False;Encrypt=True;" -p 80:5488 jsreport/jsreport:2.6.1-full
There is the dedicated article how to create your own customized docker image with the jsreport app. https://jsreport.net/learn/customize-docker-image