Revamping my previous work with Alpine to using Debian as the base operating system for generating custom Docker containers for deploying a MediaWiki instance.
Install Docker and docker-compose
according to the official installation guide.
Example: building image for MediaWiki v1.36.0
.
$ docker build --tag=debian-mediawiki:1_36 --file=Dockerfiles/v1_36 .
Locate the docker-compose.yml
then run the following command in the same directory.
# Run, spit endlessly to terminal
$ docker-compose up
# Run daemonized
$ docker-compose up -d
At the end of setting up, download LocalSettings.php
from the MediaWiki web installer (you won't miss it because it will ask), then place it inside the same directory as the docker-compose.yml
, and add the following directive under volumes:
for the mediawiki
container.
- ./LocalSettings.php:/var/www/mediawiki/LocalSettings.php
Then, stop the container (ctrl
+ c
if not daemonized, see below if daemonize) then start the containers again through docker-compose
. This time, the MediaWiki application would read the content of the LocalSettings.php
and it should run as configured.
To stop running, run:
# Bring down compose
$ docker-compose down
$ docker-compose rm
# Hard reset, first list volumes, then prune them all
$ docker volume ls
$ docker volume prune
Enter into an already-running container with the following Docker command:
$ docker exec -it <container ID> bash
To stop and delete all containers (not container images!)
# Stop them all
$ docker stop $(docker ps -a q)
# Delete them all
$ docker rm $(docker ps -a -q)
Because I run my Mediawiki with docker-compose
, here are the steps:
- Run
docker pull
, ordocker build
to fetch/generate the new image - Bring containers down with
docker-compose down
- Edit
docker-compose.yml
, if necessary (e.g. image name-change) - Run with
docker-compose up -d
- Access
mediawiki
container through shell access, go into mediawiki root installation folder (atvar/www/mediawiki
), then go intomaintenance
folder, then runphp update.php