mkdir /var/www/mediawiki && chown -R www-data /var/www/mediawiki
docker run --name my-mediawiki -v /var/www/mediawiki:/var/www/data -v /var/www/mediawiki/images:/var/www/html/images -p 8080:80 -d mediawiki
With -v we are binding the host folders /var/www/mediawiki and /var/www/mediawiki/images to container so the content persists on upgrade/container deletion.
Run the installation wizard and at the end and copy the LocalSettings.php file to /var/www/mediawiki. Bind LocalSettings.php to container and rerun it
We can't do this in the step above because binded volumes are always created as directories. This enables us to easier make modifications by editing LocalSettings.php
on the host server instead of copying the modified LocalSettings.php
to container via docker cp LocalSettings.php my-mediawiki:/var/www/html
command.
docker stop mediawiki && docker rm mediawiki
and rerun the run command this time adding the bind for LocalSettings.php file
docker run --name my-mediawiki -v /var/www/mediawiki:/var/www/data -v /var/www/mediawiki/images:/var/www/html/images -v /var/www/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php -p 8080:80 -d mediawiki