2

I have locally installed MediaWiki using Docker Compose, as described in the documentation.
It works as expected.

My project folder contains only LocalSettings.php and compose.yaml.
The latter now looks like this:

services:

  mediawiki:
    image: mediawiki
    restart: always
    ports:
      - 8080:80
    links:
      - database
    volumes:
      - images:/var/www/html/images
      - ./LocalSettings.php:/var/www/html/LocalSettings.php
  
  database:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: my_wiki
      MYSQL_USER: wikiuser
      MYSQL_PASSWORD: example
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
    volumes:
      - db:/var/lib/mysql

volumes:
  images:
  db:

But now I have to make some adaptations in the PHP files. How can I do that?
(Apparently they are somewhere in /var/lib/docker, where I should not poke around.)

I would like to see (and potentially edit) all the MediaWiki code in a subfolder of my project folder.
I thought a line like - ./html:/var/www/html would do it, but that does not work.

BTW, what does - images:/var/www/html/images mean? To the right of the colon is a folder in the container, but what is the images to its left?

3
  • 1
    Usually you copy the source into the container when building. But for developing (!!!) not production, you may mount a volume to your local drive to the src (like you did with images). Commented Oct 30 at 21:27
  • If you're using VSCode you can install the Docker extension and it will let you edit files in a running container, as if they were local. Note however, if you're editing files that are inside the container, you're going to lose your edits when the container exits. If you're just fiddling, this is fine. But if you're doing actual development, you'll need to maintain the source locally, outside the container. (And then mount it virtually, as @MarkusZeller suggests.) Commented Oct 30 at 22:54
  • Do you have the source for media wiki already on your local machine? What kind of modifications, for what purpose, are you intending to make? Please edit the question to clarify. Commented Oct 31 at 6:18

1 Answer 1

3

First you can copy html folder from docker container which works fine.

 docker cp [mediawiki_container_name]:/var/www/html ./html

then you can use - ./html:/var/www/html

and modify in local html dir.

Sign up to request clarification or add additional context in comments.

1 Comment

Initially I had the impression, that changes appear only after stopping an running docker compose up again. (Tested by changing the icon paths in $wgLogos in LocalSettings.php.) But generally that is not necessary. (A change to Footer.mustache instantly apears on every page.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.