How to install MantisBT in Docker container?

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
UlPa
Posts: 1
Joined: 08 Jan 2025, 23:44

How to install MantisBT in Docker container?

Post by UlPa »

Hi.
How to install MantisBT in Docker container?
Here is my file for Docker-Compose (docker-compose.yaml):

Code: Select all

services:
  mantisbt:
    image: xlrl/mantisbt
    environment:
      MANTIS_ENABLE_ADMIN: 1
      PHP_DISPLAY_ERRORS: 1
      PHP_DISPLAY_STARTUP_ERRORS: 1
      PHP_ERROR_REPORTING: 'E_ALL' 
      PHP_LOG_ERRORS: 1
      PHP_ERROR_LOG: /var/www/html/config/php_errors.log
    ports:
      - "8989:80"
    links:
      - mysql
    depends_on:
      - mysql
    networks:
      - mantis_net
    volumes:
      - ./config:/var/www/html/config
      - ./custom:/var/www/html/custom
      - ./plugins:/var/www/html/plugins
      - ./log:/var/log/mantis
      - /tmp/mantis:/tmp/mantis
    restart: always

  mysql:
    image: ubuntu/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysecretpasswd2
      - MYSQL_DATABASE=bugtracker
      - MYSQL_USER=amantisuser
      - MYSQL_PASSWORD=mysecretpasswd
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      - mantis_net
    restart: always

networks:
  mantis_net:
    driver: bridge
Here is my file for MansisBT settings (config/config_inc.php)

Code: Select all

<?php
$g_hostname               = 'my.site.org';
$g_db_type                = 'mysqli';
$g_database_name          = 'bugtracker';
$g_db_username            = 'amantisuser';
$g_db_password            = 'mysecretpasswd';
$g_default_timezone       = 'UTC';
$g_crypto_master_salt     = 'BRTyArGi77odpU08rLw8t1LTphLw4Q8ILa5Daq5D7oM=';
$g_path                   = '';
I work under the root user. I run the setup via the command:
docker-compose up

Both containers work:
a9827770da74 xlrl/mantisbt "/bin/sh -c /usr/loc…" 4 hours ago Up 26 minutes 0.0.0.0:8989->80/tcp, :::8989->80/tcp mantisbt-mantisbt-1
b4b26cb64492 ubuntu/mysql "docker-entrypoint.s…" 4 hours ago Up 26 minutes 3306/tcp, 33060/tcp mantisbt-mysql-1
I set up a proxy server (Nginx):

Code: Select all

server {
    server_name my.site.org;
    location / {
        proxy_pass http://localhost:8989;
     }
The cache has been cleared and the server has been restarted.
But when I go to my site, I see this:
APPLICATION ERROR #400
Connection to the database failed. Error received - #2002: Connection refused.
What am I doing wrong?
Thank you.
cas
Posts: 1768
Joined: 11 Mar 2006, 16:08
Contact:

Re: How to install MantisBT in Docker container?

Post by cas »

This is not really a Mantis issue but my friend came wit this answer (and my friend is available 24/7) :D
Have a look herer:
https://stackoverflow.com/questions/354 ... -container
Post Reply