OTRS 5 Ticketing System
Unofficial OTRS 5 Free docker image. This repository contains the
Dockerfiles and all other files needed to build and run the container.
We also include a MariaDB Dockerfile for a pre-configured image with the required database settings.
The OTRS image doesn't include a SMTP service, decoupling applications into multiple containers makes it
much easier to scale horizontally and reuse containers. If you don't have access to a SMTP server, you
can instead link against this SMTP relay postfix container.
These images are based on the official CentOS images and
include the latest OTRS version. Older images will be tagged with the OTRS version they run.
Mod_perl is enabled by default.
OTRS 4 image sources are still available in otrs-4_0_x branch.
docker-compose to build the images. Clone this repo and then:
cd docker-otrs sudo docker-compose build
This command will build all the images and pull the missing ones like the SMTP relay. This SMTP relay container has its own configuration, you need to specify the environment variables for the SMTP account that will be used to send OTRS email notifications. Please take a look at the documentation.
How to run it
By default, when the container is run it will load a default vanilla OTRS
OTRS_INSTALL=no) that is ready to be configured as you need. However, you can load
a backup or run the installer by defining one of these environment variables:
OTRS_INSTALL=restoreWill restore the backup specified by
OTRS_BACKUP_DATEis the backup name to restore, in the same date_time format that the OTRS backup
script uses, for example
OTRS_BACKUP_DATE="2015-05-26_00-32"(This is the notation that the backup script that comes with OTRS uses). Backups must be inside the /var/otrs/backups directory (you should host mount it).
OTRS_DROP_DATABASE=yesWill drop the otrs database it if already exists (by default the container will fail if the database already exists).
You need to mount that backups volume from somewhere, it can be from another volume (using --volumes-from) or mounting
a host volume which contains the backup files.
OTRS_INSTALL=yesWill run the installer which you can access at:
If you are running the container remotely, replace localhost with the server's hostname.
There are also some other environment variables that can be set to customize
the default install:
OTRS_HOSTNAMESets the container's hostname (autogenerated if not defined).
OTRS_SYSTEM_IDSets the system's ticketing ID.
OTRS_ADMIN_EMAILSets the admin user email.
OTRS_ORGANIZATIONSets the organization name (ex: MyCompany Ltd.)
OTRS_DB_PASSWORDotrs user database password. If it's not set the password will be randomly generated (recommended).
OTRS_ROOT_PASSWORDroot@localhost user password. Default password is
OTRS_POSTMASTER_FETCH_TIMESets the time interval (at otrs user's crontab) OTRS should fetch emails from the configured postmaster accounts. This value it's 10 minutes by default, but I like to set it to 5 minutes. Email fetching can be disabled altogether by setting this variable to 0 (useful while configuring).
OTRS_LANGUAGESet the default language for both agent and customer interfaces (For example, "es" for spanish).
OTRS_TICKET_COUNTERSets the starting point for the ticket counter.
OTRS_NUMBER_GENERATORSets the ticket number generator, possible values are : DateChecksum, Date, AutoIncrement or Random.
Those environment variables is what you can configure by running the installer for a default install, plus other useful ones.
For production use there's another
docker-compose file that points to the pre-built images. After adjusting the
docker-compose-prod.yml file with the previously described environment variables (don't forget to configure the SMTP relay), you can test the service with
sudo docker-compose -f docker-compose-prod.yml up
This will pull and bring up all needed containers, link them and mount volumes according
docker-compose-prod.yml configuration file.
The default database password is
changeme, to change it, edit the
docker-compose.yml file and change the
MYSQL_ROOT_PASSWORD environment variable on the
mariadb image definition before
To start the containers in production mode the the
-d parameter to the previous command:
sudo docker-compose -f docker-compose-prod.yml -p companyotrs up -d
After the containers finish starting up you can access the OTRS system at the following
Installing OTRS modules
If you have installed any additional module, the OTRS container will reinstall them after an upgrade or when a container is removed so they continue working.
Changing OTRS default skins
The default skins and logos for the agent and customer interfaces can be controlled with the following
To set the agent interface skin set
OTRS_AGENT_SKIN environment variable, for example:
To set the agent Interface logo set
You can also control the logo's size and placement (set in px units):
OTRS_AGENT_LOGO_HEIGHT: 50 OTRS_AGENT_LOGO_RIGHT: 40 OTRS_AGENT_LOGO_TOP: 5 OTRS_AGENT_LOGO_WIDTH: 240
To set the customer interface skin set
OTRS_CUSTOMER_SKIN environment variable, for example:
To set the customer Interface logo set
You can also control the logo's size and placement (set in px units):
OTRS_CUSTOMER_LOGO_HEIGHT: 50 OTRS_CUSTOMER_LOGO_RIGHT: 40 OTRS_CUSTOMER_LOGO_TOP: 5 OTRS_CUSTOMER_LOGO_WIDTH: 240
If you are adding your own skins, the easiest way is create your own
Dockerfile inherited from this image and then
COPY the skin files there. You can also set all the environment variables in there too, for example:
FROM juanluisbaptiste/otrs:latest MAINTAINER Foo Bar <email@example.com> ENV OTRS_AGENT_SKIN mycompany ENV OTRS_AGENT_LOGO skins/Agent/mycompany/img/logo.png ENV OTRS_CUSTOMER_LOGO skins/Customer/default/img/logo_customer.png COPY skins/ $SKINS_PATH/ RUN mkdir -p $OTRS_ROOT/Kernel/Config/Files/ COPY skins/Agent/MyCompanySkin.xml $OTRS_ROOT/Kernel/Config/Files/
Using host-mounted data containers
The included docker-compose file uses
host mounted data containers to store the database and configuration contents outside the containers. Please take a look at the
docker-compose.yml to see the directory mappings and adjust them to your needs (available on both OTRS 4 & 5 images).
Make sure that the directories on the docker host for both OTRS configuration and the MySQL data containers have the correct permissions to be accessed from within the containers. The
volumes/mysql directory should be owned by the MySQL user (27) and the
volumes/config directory must be owned by id 500 and group id 48. Before running
docker-compose up make sure permissions are ok:
chown 27 volumes/mysql chown 500:48 volumes/config
/opt/otrs/scripts/otrs_backup.sh script to create a full backup that will be copied to /var/otrs/backups. If you mounted that directory as a host volume then you will have access to the backups files from the docker host server. You can setup a periodic cron job on the host that runs the following command:
docker exec otrs_container /opt/otrs/scripts/otrs_backup.sh
Enabling debug mode
If you are having issues starting up the containers you can set
OTRS_DEBUG=yes to print a more verbose container startup output.
It prompts for a password when I run the prebuilt image, I've tried with the environment variables without success, do you have any suggestion?:
docker run -it --name otrs -p 80:80 juanluisbaptiste/otrs
Glad you like it, please report any bugs you find at the github project. Next version will handle installation of custom skins :)
This looks like everything has been done right. Thanks for the great images!