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:
- 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).
- 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.
- Then access mediawiki webinterface at http://localhost/
- Setup wiki and use database hostname mediawiki-mysql and root password secret
- Download LocalSettings.php provided at end of setup
- docker ps
- docker stop <container-ID>
- First few characters of ID are enough, whole ID is not required
- 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