MediaWiki is a free and open-source wiki app, used to power wiki websites such as Wikipedia, Wiktionary and Commons, developed by the Wikimedia Foundation and others.
docker run --name wiki -p 80:80 -e MEDIAWIKI_SITE_SERVER=http://wiki.example.com -d epuzanov/mediawiki
Partial explanation of arguments:
--net
allows you to connect this container with a database container. SeeConfigure Database
below for more details.-v
is used to mount a shared folder with the container. SeeShared Volume
below for more details.
Having troubling accessing your MediaWiki server? See Accessing MediaWiki
below for help.
Use the following environmental variables to generate a LocalSettings.php
and perform automatic installation of MediaWiki.
-e MEDIAWIKI_SITE_SERVER=
(required set this to the server host and include the protocol (and port if necessary) like//wiki
; configures$wgServer
)-e MEDIAWIKI_SITE_NAME=
(defaults toMediaWiki
; configures$wgSitename
)-e MEDIAWIKI_SITE_LANG=
(defaults toen
; configures$wgLanguageCode
)-e MEDIAWIKI_ADMIN_USER=
(defaults toadmin
; configures default administrator username)-e MEDIAWIKI_ADMIN_PASS=
(defaults toPa55word+
; configures default administrator password)-e MEDIAWIKI_UPDATE=true
(defaults tofalse
; runphp maintenance/update.php
)-e MEDIAWIKI_DB_TYPE=
(defaults tosqlite
; configures$wgDBtype
)-e MEDIAWIKI_DB_HOST=
(defaults todb
; configures$wgDBserver
)-e MEDIAWIKI_DB_PORT=
(defaults to3306
; configures$wgDBport
)-e MEDIAWIKI_DB_SCHEMA=
(defaults tomediawiki
; configures$wgDBmwschema
)-e MEDIAWIKI_DB_USER=
(defaults towikiuser
; configures$wgDBuser
)-e MEDIAWIKI_DB_PASS=
(defaults toautogenerated
; configures$wgDBpassword
)-e MEDIAWIKI_DB_INSTALL_USER=
(defaults depends on MEDIAWIKI_DB_TYPE)-e MEDIAWIKI_DB_INSTALL_PASS=
(defaults depends on MEDIAWIKI_DB_TYPE)-e MEDIAWIKI_DB_NAME=
(defaults towikidb
; configures$wgDBname
)-e MEDIAWIKI_SCRIPTPATH=
(defaults to ``; configures$wgScriptPath
)-e MEDIAWIKI_MEMCACHED=
(defaults to ``; configures$wgMemCachedServers
)-e MEDIAWIKI_LDAP_SERVERS=
(defaults todc.example.com
; configures$wgLDAPServerNames
)-e MEDIAWIKI_LDAP_AGENT=
(defaults tocn=proxyagent,ou=Users,dc=example,dc=com
; configures$wgLDAPProxyAgent
)-e MEDIAWIKI_LDAP_AGENT_PASS=
(defaults topassword
; configures$wgLDAPProxyAgentPassword
)-e MEDIAWIKI_LDAP_BASEDN=
(defaults todc=example,dc=com
; configures$wgLDAPBaseDNs
)
As mentioned, this will generate the LocalSettings.php
file that is required by MediaWiki. If you mounted a shared volume (see Shared Volume
below), the generated LocalSettings.php
will be automatically moved to your share volume allowing you to edit it.
We currently track latest MediaWiki production branches, as run on wikipedia.org.
epuzanov/mediawiki:latest
(currently usesREL1_30
)
The example above uses --net
or --link
to connect the MediaWiki container with a running mysql container. This is probably not the best idea for use in production, keeping data in docker containers can be dangerous.
Supported Databases:
- MySQL (MEDIAWIKI_DB_TYPE=mysql)
- Postgres (MEDIAWIKI_DB_TYPE=postgres)
- SQLite (MEDIAWIKI_DB_TYPE=sqlite)
- MS SQL (MEDIAWIKI_DB_TYPE=mssql)
You can use SQLite backand for small MediaWiki setup without dedicated Database Server. MediaWiki SQLite database files will be saved in wiki configuration Shared Volume.
docker run --name wiki -p 80:80 -v /local/wiki_data/path:/data:rw -e MEDIAWIKI_SITE_SERVER=http://wiki.example.com -d epuzanov/mediawiki
You can use MySQL as your database server:
docker run --name wiki --link some-mysql:db -p 80:80 -v /local/wiki_data/path:/data:rw -e MEDIAWIKI_DB_TYPE=mysql -e MEDIAWIKI_DB_INSTALL_PASSWORD=Pa$$w0rd -e MEDIAWIKI_SITE_SERVER=http://wiki.example.com -d epuzanov/mediawiki
You can use Postgres instead of MySQL as your database server:
docker run --name wiki --link some-postgres:db -p 80:80 -v /local/wiki_data/path:/data:rw -e MEDIAWIKI_DB_TYPE=postgres -e MEDIAWIKI_DB_INSTALL_PASSWORD=Pa$$w0rd -e MEDIAWIKI_SITE_SERVER=http://wiki.example.com -d epuzanov/mediawiki
You can use the following environment variables for connecting to another database server:
-e MEDIAWIKI_DB_TYPE=...
(defaults tosqlite
, but can also bemysql
,postgres
ormssql
)-e MEDIAWIKI_DB_HOST=...
(defaults to the address of the linked database container)-e MEDIAWIKI_DB_PORT=...
(defaults to the port of the linked database container or to the default for specified db type)-e MEDIAWIKI_DB_USER=...
(defaults toroot
,sa
orpostgres
based on db type beingmysql
,mssql
orpostgres
respsectively)-e MEDIAWIKI_DB_PASSWORD=...
(defaults to the password of the linked database container)-e MEDIAWIKI_DB_NAME=...
(defaults tomediawiki
)-e MEDIAWIKI_DB_SCHEMA
... (defaults tomediawiki
, applies only to when using postgres)-e MEDIAWIKI_DB_INSTALL_USER=...
(defaults toroot
,sa
orpostgres
based on db type beingmysql
,mssql
orpostgres
respsectively)-e MEDIAWIKI_DB_INSTALL_PASSWORD=...
(defaults to the password of the linked database container)
If the MEDIAWIKI_DB_NAME
specified does not already exist on the provided MySQL server, it will be created automatically upon container startup, provided that the MEDIAWIKI_DB_INSTALL_USER
specified has the necessary permissions to create it.
To use with an external database server, use MEDIAWIKI_DB_HOST
(along with
MEDIAWIKI_DB_USER
and MEDIAWIKI_DB_PASSWORD
if necessary):
docker run --name wiki -e MEDIAWIKI_DB_HOST=10.0.0.1 -e MEDIAWIKI_DB_PORT=3306 -e MEDIAWIKI_DB_USER=wikiuser -e MEDIAWIKI_DB_PASSWORD=password epuzanov/mediawiki
If provided mount a shared volume using the -v
argument when running docker run
, the mediawiki container will automatically look for a LocalSettings.php
file, Images directory, SSL certificats and wiki.png logo file. This allows you to easily configure (LocalSettings.php
), update SSL certificats and MediaWiki Logo.
It is highly recommend you mount a shared volume so uploaded files and images will be outside of the docker container.
By default the shared volume must be mounted to /data
on the container.
Replace server.key and server.crt files on shared volume with you files. docker run --name wiki -p 443:443 -e MEDIAWIKI_SITE_SERVER=https://wiki.example.com -d epuzanov/mediawiki
docker run --name wiki1 --net wikinet -v /local/wiki1:/data:rw -e MEDIAWIKI_SITE_SERVER=http://wiki1.example.com -d epuzanov/mediawiki /usr/sbin/php-fpm
docker run --name wiki2 --net wikinet -v /local/wiki2:/data:rw -e MEDIAWIKI_SITE_SERVER=http://wiki2.example.com -d epuzanov/mediawiki /usr/sbin/php-fpm
docker run --name wiki3 --net wikinet -v /local/wiki3:/data:rw -e MEDIAWIKI_SITE_SERVER=http://wiki3.example.com -d epuzanov/mediawiki /usr/sbin/php-fpm
docker run --name httpd --net wikinet -p 80:80 -v /local/wiki1:/data/wiki1:rw -v /local/wiki2:/data/wiki2:rw -v /local/wiki3:/data/wiki3:rw -d epuzanov/mediawiki