User Tools

Site Tools


wiki:mediawiki_inside_docker_container

MediaWiki inside Docker container

Create root web folder

mkdir /var/www/mediawiki && chown -R www-data /var/www/mediawiki

Download image and run it

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.

So stop and remove the container now

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

See also

References

wiki/mediawiki_inside_docker_container.txt · Last modified: 2020/12/17 12:02 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki