Running pre-built public images with docker

From Notes_Wiki

Home > CentOS > CentOS 7.x > Virtualization > Docker > Running pre-built public images with docker

Running Mediawiki using docker

To setup a Mediawiki container which talks to a MySQL container use:

  1. Start MySQL container using:
    docker run --name mediawiki-mysql -e MYSQL_ROOT_PASSWORD=secret -d mysql
    Here -e is used to set environment which can be referred by scripts inside docker container. -d is to run this container detached (in-background).
  2. Then run mediawiki web container using:
    sudo docker run --link mediawiki-mysql:db -p 80:80 -d simplyintricate/mediawiki
    Here -p 80:80 sets up port forward from port 80 of local machine to port 80 of mediawiki container.
  3. Then access mediawiki webinterface at http://localhost/
  4. Setup wiki and use database hostname mediawiki-mysql and root password secret
  5. Download LocalSettings.php provided at end of setup
  6. docker ps
  7. docker stop <container-ID>
    • First few characters of ID are enough, whole ID is not required
  8. Run the container again with downloaded LocalSettings.php using:
    sudo docker run -v <local-path>/LocalSettings.php:/usr/share/nginx/html/LocalSettings.php:ro --link mediawiki-mysql:db -p 80:80 -d simplyintricate/mediawiki
    Here -v binds local file at given path to other path provided within the container.

Images and extensions can be supported using:

-v <path to images>:/usr/share/nginx/html/images -v <path to extensions>:/tmp/extensions

along with other options already used above.

To make LocalSettings part of docker-image we can use following Dockerfile:

FROM simplyintricate/mediawiki

ADD LocalSettings.php /usr/share/nginx/html/LocalSettings.php

Learned using instructions at https://hub.docker.com/r/simplyintricate/mediawiki/


Home > CentOS > CentOS 7.x > Virtualization > Docker > Running pre-built public images with docker