Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).

How to setup Mediawiki in seconds using Docker?

2 min read

I still follow the same old traditional mediawiki software to track the roadmap, knowledge base articles, latest and updates for Linux Kernel, released operating systems etc. It has been maintained since last 3 years and there is around huge amount of data in a monolithic server. Migrating the data from the old server to a new one was one of most challenging task I have been asked for. The first thing which came to my mind was “Has it been implemented through Docker, I would have migrated it so easily.” That’s true.

Just one thought and I decided to demonstrate it to my team members how easy is it play around the docker to do all these migration so easy. Here goes the demonstration:

Just two commands – one for MySQL and one for Mediawiki and that’s enough to setup mediawiki. (Yes docker compose might have done it in a single shot)

Setting up MySQL container:

#docker run -d -it \

–name mysql4me \

-h mysql \

-p 3306:3306  \

-e CREATEDB=false \

-e MYSQL_USER=’admin’ \

-e MYSQL_PASS=’mysql123′ \

-e MYSQL_CLIENT=’172.17.0.%’ \

-e TERMTAG=mysql \

appcontainers/mysql

Trying to pull repository docker.io/appcontainers/mysql …
41761f3abd2d: Download complete
a939136a931f: Download complete
7401b06a45d9: Download complete
14f0208b808f: Download complete
b17c76062d08: Download complete
c78917b2cdad: Download complete
f87ea8845b1e: Download complete
9b08e78d224c: Download complete
c86cfaf3af69: Download complete
a126bf054304: Download complete
98223298da0d: Download complete
bd7ddd0cbc5f: Download complete
590d8ca3ab76: Download complete
9ac9a11cf920: Download complete
24f3acb1a3eb: Download complete
d78d035692d5: Download complete
b6ba40403c71: Download complete
4abf5bd70eac: Download complete
Status: Downloaded newer image for docker.io/appcontainers/mysql:latest
7b31b6ddf68c8662bafa9d2bcd3497b802a968ac5a32c49f8f8da7084d2a8da9
Usage of loopback devices is strongly discouraged for production use. Either use `–storage-opt dm.thinpooldev` or use `–storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
[root@localhost ~]#

Setting up Mediawiki:

#docker run -d -it \
–name mediawiki \
-h mediawiki \
-p 80:80 \
-p 443:443 \
–link mysql4me:mysql4me \
-e MODE=’remote’ \
-e APP_NAME=’mywiki.collabnix.com’ \
-e APACHE_SVRALIAS=’www.mywiki.collabnix.com localhost’ \
-e MYSQL_USER=’superuser’ \
-e MYSQL_PASS=’superpassword’ \
-e MYSQL_SERVER=’mysql’ \
-e MYSQL_CLIENT=’%’
-e MYSQL_DB=’mywiki’ \
-e APP_USER=’appadmin’ \
-e APP_PASS=’mysql123′ \
-e ENV=production \
-e TERMTAG=prod \
appcontainers/mediawiki

latest: Pulling from docker.io/appcontainers/mediawiki
a939136a931f: Pulling fs layer
014f79460896: Pulling fs layer
a5939e1f2c38: Pull complete
4c662f8ea056: Pull complete
29958c3d2bee: Pull complete
f739b15a894c: Pull complete
36b3919b595f: Pull complete
13102717cb0f: Pull complete
00d86b5edd2c: Pull complete
3f8666f331d8: Pull complete
3fbdc2a1e6a3: Pull complete
14409773a2e7: Pull complete
888c55e0136f: Pull complete
9fc6e6b99994: Pull complete
63b836c8d4a0: Pull complete
fe532d458f4a: Pull complete
324bd74f5dca: Pull complete
67455c7c3253: Pull complete
6c56a8938e47: Pull complete
12e6a53d024d: Pull complete
92501207ca7d: Pull complete
0c18d9501d2c: Pull complete
14f572001b64: Pull complete
33eff36184af: Pull complete
df6b2d5222b9: Already exists
Digest: sha256:b6106f7f1bb5c005afb6f265e50d033d25a80e28199c84f758dccc0adaf15bd3
Status: Downloaded newer image for docker.io/appcontainers/mediawiki:latest
e03b481f4f3dfafb62e2b8c5266f980a946e1861c9fbe63bd7cda13b79a4876e
Usage of loopback devices is strongly discouraged for production use. Either use `–storage-opt dm.thinpooldev` or use `–storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.

DONT FORGET TO FLUSH PRIVILEGES; to get it working.
Granting MySQL DB permission with superuser:

bash: GRANT: command not found
🙁 mysql root@mysql/ # mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.43 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘superuser’@’%’ IDENTIFIED BY ‘superpassword’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.28 sec)

mysql> exit
Bye
🙂 mysql root@mysql/ # [root@localhost containers]# clear
[root@localhost containers]#

That’s all.Browse to https://localhost:443 and way to play around with mediawiki.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).
Join our Discord Server