Jump to content

Docker/Docker Hub

From mediawiki.org
(Redirected from Docker/Hub)

This page is about the external Docker Hub account maintained by Docker, Inc., offering MediaWiki images useful to design new custom environments, also for production.

If you are strictly interested in an official fast local development environment with Docker Compose, see MediaWiki-Docker instead.

Description

[edit]

Docker, Inc. 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.

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

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.

mediawiki:
    image: mediawiki:latest
    container_name: mediawiki
    ports:
      - "8080:80"
    environment:
      MEDIAWIKI_DB_HOST: db
      MEDIAWIKI_DB_USER: mediawiki
      MEDIAWIKI_DB_PASSWORD: P@ssw0rd
      MEDIAWIKI_DB_NAME: mediawiki
    depends_on:
      - db
    volumes:
      - ./mediawiki_data:/var/www/html/images
    # - ./LocalSettings.php:/var/www/html/LocalSettings.php

  db:
    image: mysql:5.7
    container_name: mediawiki_db
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: P@ssw0rd
      MYSQL_DATABASE: mediawiki
      MYSQL_USER: wiki
      MYSQL_PASSWORD: P@ssw0rd
    volumes:
      - ./db_data:/var/lib/mysql

We are building and launching a stack of containers with the MediaWiki application and the database described in the wiki.yml file:

docker compose -f wiki.yml up -d

After installation, proceed to LocalSettings.php and drop into

docker cp /home/.../LocalSettings.php ID:/var/www/html