Topic on Project:Support desk

Upload fails in docker container.

5
77.119.130.7 (talkcontribs)

Before building the docker container with the command 'chown www-data:www-data /var/www/html/images'. I would get an error like "

Could not open lock file for "mwstore://local-backend/local-public/4/4c/whereverfile.png".
Make sure your upload directory is configured correctly and your web server has
permission to write to that directory.
See https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgUploadDirectory for
more information.

"

Now I get this error just above the upload form:

Could not create directory "mwstore://local-backend/local-public/3/3d".

I have tried everything I can think of here, enabled and disabled all relevant variables. (wgUploadPath etc.)

But still no luck.

Mediawiki Version 1.35.2

My docker image is based on the official image.

178.165.178.236 (talkcontribs)

The only relevant error log line that I found is this one:

[FileOperation] StoreFileOp failed (batch #): {"src":"/tmp/phpmM6Q2b","dst":"mwstore://local-backend/local-temp/7/74/20210601225411!phpmM6Q2b.png","overwrite":true,"headers":[],"failedAction":"attempt"}


LocalSettings:

$wgUploadDirectory = "/var/www/html/images";

$wgTmpDirectory = "/var/www/html/images/tmp/";

$wgUploadPath = "/images";

$wgEnableUploads = true;

Beet keeper (talkcontribs)

Using the September 3 commit here "ca4ff793fbe5a7f1bad6b16aad763afc4a1799b8" and I'm running 1.35.2. Not having to set $wgUploadDirectory or $wgUploadPath to make it work out of the box - my problem comes trying to mount a volume and then write to it. Same error. Something like this in the docker-compose.yml:


+      # Custom uploads directory.

+      - ./uploads:/var/www/html/uploads/:rw


And then setting those in LocalSettings.php: "$wgScriptPath/uploads" but I can't find the magic combination to get it to work. I can't see a trace in the logs either.

Beet keeper (talkcontribs)

I should add, I am using a Wikibase image, which might not be relevant for you. In addition to the uploads directory that I mounted for the Wikibase image, I added a user to the service as follows:


      user: "www-data:www-data"


And that solved the problems here. I could see from the container that I was able to write to my uploads directory and that it belonged to www-data. After that I attempted an upload in Wikimedia/Wikibase and it worked.


My LocalSettings.php are also configured as follows;


+$wgUploadDirectory = "$IP/uploads";

+$wgUploadPath = "$wgScriptPath/uploads";


Which I believe is in-line with the documentation. I can see the uploads in the directory and all new uploads are visible too. (Some folk may need to merge a previous "image" or "upload" directory into their new mount point to see old files.

TiltedCerebellum (talkcontribs)

Usually the help desk recommends installing without docker, and instead using their official supported installation method.

Reply to "Upload fails in docker container."