MediaWiki-Docker/Configuration recipes/Customize base image

Jump to navigation Jump to search

Sometimes we need to customize the base image used for mediawiki. For example, we may need to install additional packages. To do that follow the below steps:

Modify the mediawiki service in docker-compose.override.yaml as follows:

version: '3.7'
    # On Linux, these lines ensure file ownership is set to your host user/group
    user: "${MW_DOCKER_UID}:${MW_DOCKER_GID}"
      context: ./path/to/custom/Dockerfile/Directory
      dockerfile: Dockerfile
    user: "${MW_DOCKER_UID}:${MW_DOCKER_GID}"

In that custom Dockerfile, build everything on top of base image. Suppose, we want to install imagemagick

# Important: Make sure the version here matches the latest version of the mediawiki image in docker-compose.yml

RUN apt update && \

   apt install -y imagemagick

# Add any additional image preparation code here.

The base image (e.g. buster-php72-fpm:2.0.0 should match that used for the mediawiki service in the docker-compose.yml file.

You should run docker-compose build after changing this Dockerfile.