MediaWiki

version: '3'
services:
  mediawiki:
    image: mediawiki
    restart: always
    ports:
      - 11111:80
    links:
      - database
    volumes:
      - /var/mediawiki/images:/var/www/html/images
      # After initial setup, download LocalSettings.php to the same directory as
      # this yaml and uncomment the following line and use compose to restart
      # the mediawiki service
      # - /var/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php
    networks:
      - mediawiki-net
  database:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: wikidb
      MYSQL_USER: wikiuser
      MYSQL_PASSWORD: example
      MYSQL_ROOT_PASSWORD: example2
    volumes:
      - /var/mediawiki/mysql:/var/lib/mysql
    networks:
      - mediawiki-net

networks:
  mediawiki-net:

Note the MariaDB root password will be properly initialized only if the volume begins empty, otherwise the initialized database is started up instead. To check if sudo docker-compose down -v removes the volume data.

To copy the SQL dump: sudo docker cp dumpfile.sql mariadb_container_name:/

References:

For porting issues with MathJax, consider the following explanation and hacks:

Bare metal installation

For bare metal installation:

sudo apt install nginx-full
sudo apt install mariadb-server

# For Mediawiki 1.39
sudo apt install php php-apcu php-intl php-mbstring php-xml php-mysql php-calendar php-fpm

# For Mediawiki 1.32
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4 php7.4-fpm php7.4-apcu php7.4-intl php7.4-mbstring php7.4-xml php7.4-mysql php7.4-calendar

# Secure for production, and test root password
sudo mysql_secure_installation
mysql -uroot -p
MariaDB> CREATE DATABASE my_wiki;
mysql -p wikidb < mysql.dump

# Unpack and move to location
tar xzhf mediawiki-*.tar.gz
sudo mv mediawiki-*/ /var/www/mediawiki/
cd /var/www
sudo chown -R www-data:www-data mediawiki
sudo chmod 755 mediawiki

Issues with upgrading Mediawiki 1.32 to 1.39, including:

  1. 1.32 not compatible with PHP 8.1, so need to install old PHP packages
  2. 1.39 has several changes in configuration variables due to codebase sanitization: wgMimeTypeExclusions, and...
  3. 1.39 has some additional tables in database, which is needed for maintenance/update.php itself. Gave up.