8

I tried

mediawiki docker

it says:

When first run, the container will not contain a LocalSettings.php

But i don't understand how to get this contained LocalSettings.php what do I type to get this file? and how to I replace it?

4 Answers 4

3

The docker images from mediawiki docker uses Volumes which is clearly given in the description on the page. In case of Docker images with volumes when you download the image you need to create a similar volume on your host too, because downloading a docker image doesn t download the docker volume.

As it is stated on that page, you need to create a volume in the host and put that LocalSettings.php file and then create a container as:

docker stop $CONFIG_CONTAINER
docker run -v /data/wiki:/data -d nickstenning/mediawiki
3
  • 1
    But where do I get this LocalSettings.php file from?
    – Jas
    Sep 7, 2014 at 10:18
  • @Jas I dont have much idea about mediawiki, I guess this mediawiki.org/wiki/Manual:LocalSettings.php can help you.
    – beginer
    Sep 7, 2014 at 10:22
  • so i need to mount ./LocalSettings.php, /data, /var/www/html/sites or /var/www/html? or all of the above? and does LocalSettings.php go into /data? or /var/www/html?
    – ierdna
    Jul 1, 2021 at 18:53
1

1.- We need to obtain the name of the docker

docker ps

2.- Obtain a shell inside the docker container

docker exec -it <dockername> /bin/bash

/var/www/html# ls -l
total 1576
-rw-rw-r--  1     1000     1000     168 Sep 24 22:22 CODE_OF_CONDUCT.md
-rw-rw-r--  1     1000     1000   19421 Nov  4  2019 COPYING
-rw-rw-r--  1     1000     1000   13101 Sep 24 22:22 CREDITS
-rw-rw-r--  1     1000     1000      95 Nov  4  2019 FAQ
-rw-rw-r--  1     1000     1000 1151718 Sep 24 22:22 HISTORY
-rw-rw-r--  1     1000     1000    3581 Sep 24 22:22 INSTALL
-rw-rw-r--  1     1000     1000    1525 Sep 24 22:22 README.md
-rw-rw-r--  1     1000     1000   84664 Sep 25 14:36 RELEASE-NOTES-1.35
-rw-rw-r--  1     1000     1000     199 Nov  4  2019 SECURITY
-rw-rw-r--  1     1000     1000   12142 Sep 24 22:22 UPGRADE
-rw-rw-r--  1     1000     1000    4490 Sep 24 22:22 api.php
-rw-rw-r--  1     1000     1000  156532 Sep 24 22:22 autoload.php
drwxr-xr-x  2 www-data www-data    4096 Sep 30 01:19 cache
-rw-rw-r--  1     1000     1000    4719 Sep 24 22:22 composer.json
-rw-rw-r--  1     1000     1000     102 Nov  4  2019 composer.local.json-sample
drwxr-xr-x  5 root     root        4096 Sep 30 01:19 docs
drwxr-xr-x 30 www-data www-data    4096 Sep 30 01:19 extensions
drwxr-xr-x  1 www-data www-data    4096 Oct  1 10:47 images
-rw-rw-r--  1     1000     1000    8245 Sep 24 22:22 img_auth.php
drwxr-xr-x 83 root     root        4096 Sep 30 01:19 includes
-rw-rw-r--  1     1000     1000    1977 Sep 24 22:22 index.php
-rw-rw-r--  1     1000     1000    1428 Sep 24 22:22 jsduck.json
drwxr-xr-x  6 root     root        4096 Sep 30 01:19 languages
-rw-rw-r--  1     1000     1000    1951 Sep 24 22:22 load.php
drwxr-xr-x 14 root     root       12288 Sep 30 01:19 maintenance
drwxr-xr-x  4 root     root        4096 Sep 30 01:19 mw-config
-rw-rw-r--  1     1000     1000    4610 Sep 24 22:22 opensearch_desc.php
drwxr-xr-x  5 root     root        4096 Sep 30 01:19 resources
-rw-rw-r--  1     1000     1000     998 Sep 24 22:22 rest.php
drwxr-xr-x  5 www-data www-data    4096 Sep 30 01:19 skins
drwxr-xr-x 10 root     root        4096 Sep 30 01:19 tests
-rw-rw-r--  1     1000     1000   23408 Sep 24 22:22 thumb.php
-rw-rw-r--  1     1000     1000    1439 Sep 24 22:22 thumb_handler.php
drwxr-xr-x 16 root     root        4096 Sep 30 01:19 vendor
root@e532ae3bb563:/var/www/html# cat > LocalSettings.php

3.- Create a file and copy the contents of LocalSettings.php inside the directory

cat > LocalSettings.php

(and paste with the terminal the contents of the downloaded LocalSettings, you can use some editor but using this command pasting the content and the ctrl+c should work).

0

This is old, although I didn't have much success with copying in a previous LocalSettings.php. You just pass in the extra environment variables and a LocalSettings.php will be created in the data directory. Then you just put your custom changes in conf/CustomSettings.php

Use the following environmental variables to generate a LocalSettings.php

  • -e MEDIAWIKI_ADMIN_USER= (defaults to admin; configures default administrator username)

  • -e MEDIAWIKI_ADMIN_PASS= (defaults to rosebud; configures default administrator password)

https://github.com/wikimedia/mediawiki-docker

I at least imported a previous database to get the posts visible, using the generated config and just adding my custom settings.

0

Once you have completed the installation steps after you first initiated your container, you will be given a page with a LocalSettings.php file to download.

What worked for me was to download this file inside the container already, like the following:

  1. Open a terminal inside the container (you can use Docker Desktop to do that by clicking on the CLI button in the container view OR run the command docker exec -it <container name> /bin/sh)
  2. Inside the terminal, run the command: curl http://0.0.0.0:80/mw-config/index.php?localsettings=1 > LocalSettings.php

That's it! It will download de generated file into your root folder, which is where the terminal will open at start.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .