Docker/Hub - MediaWiki (2024)

Docker maintains a list of official images which "are a curated set of Docker repositories hosted on Docker Hub." These images are official to Docker and not to MediaWiki. The images meet Docker's best practices of what they believe makes a good base image, it does not fulfill all of the roles and capabilities that MediaWiki has to offer. The image intentionally includes only the minimal amount of software necessary to run MediaWiki. It is designed to be extended from rather than used directly.

The MediaWiki image can be found at:

https://hub.docker.com/_/mediawiki

The source code can be found at:

https://github.com/wikimedia/mediawiki-docker

When changes are made to this git repository, they must be deployed to Docker hub by modifying the configuration file in their repository:

https://github.com/docker-library/official-images/blob/master/library/mediawiki

Using on a single web server[edit]

A multi-server environment should use Kubernetes instead of Docker Compose. In fact, it may be better for a single server to use microk8s than Docker Compose (although for users operating in virtual machines, such as libxen or qubes appVM's, microk8s may not run well or at all).

Quick Start[edit]

  1. Install Docker
  2. Install Docker Compose
  3. Create a folder for your project.
  4. Create a docker-compose.yml with the sample contents.
  5. Run docker-compose up -d.
  6. After running the installer, add the LocalSettings.php file and mount it into the container by uncommenting the relevant line in your docker-compose.yml.

Initial docker-compose.yml[edit]

This sample assumes you will use a SQLite database. This makes MediaWiki available on port 80.

version: '3.2'services: web: image: mediawiki ports: - 80:80 volumes: # - ./LocalSettings.php:/var/www/html/LocalSettings.php - database:/var/www/data - images:/var/www/html/imagesvolumes: database: images:

Using for MediaWiki Development[edit]

Quick Start[edit]

  1. Install Docker
  2. Install Docker Compose
  3. Create a folder for your project.
  4. Create a docker-compose.yml with the sample contents.
  5. Clone MediaWiki in a subfolder called html.
  6. Install the PHP dependencies by running docker run --rm --interactive --tty --volume $PWD/html:/app composer install or composer install -d ./html if you have composer installed.
  7. Disable OPCache
  8. Run docker-compose up

Sample docker-compose.yml[edit]

This sample assumes you will use a SQLite database. This makes MediaWiki available on port 8888.

version: '3.2'services: web: image: mediawiki ports: - 8888:80 volumes: - ./html:/var/www/html:cached - database:/var/www/datavolumes: database:

Disabling OPCache[edit]

Create a .htaccess file in the web root, typically html/.htaccess with the following content:

php_flag opcache.enable Off

Adding a Database Server[edit]

This is a more complex example with an attached MariaDB server. MediaWiki should be configured to reach the database server at the database hostname.

version: '3.2'services: web: image: mediawiki links: - database volumes: - images:/var/www/html/images - ./LocalSettings.php:/var/www/html/LocalSettings.php database: image: mariadb environment: MYSQL_DATABASE: 'my_wiki' MYSQL_USER: 'wikiuser' MYSQL_PASSWORD: 'example' MYSQL_RANDOM_ROOT_PASSWORD: 'yes' volumes: - database:/var/lib/mysqlvolumes: database: images:
Docker/Hub - MediaWiki (2024)
Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 5913

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.