Docker for Windows : corrupted files

Viewed 568

This post is about an issue that I am having using webpack and Vue.js and the stable version of Docker for Windows.

It seems that large compiled files ( more than 1 Mb ) are splitted into chunks when sent over from the Virtual Machine, and it turns out that 90% of the time they end up corrupted ( parts of other files seems to get injected in between files chunks ).

I came across a few reported bugs that are happening on both Windows and MacOS, it seems that these similar issues gets solved by changing Apache configuration to sendfile Off AND/OR MMAP Off inside the Dockerfile :

RUN sed -i -e 's/EnableSendfile On\/EnableSendfile Off/g' /etc/apache2/httpd.conf

RUN sed -i -e 's/EnableMMAP On\/EnableMMAP Off/g' /etc/apache2/httpd.conf

This did not fix anything for me..

As you can see, without any code change, after each hard-refresh, these are the errors that come up, every time at a different line, because of corrupted file outputs:

Various outputs based on corruptied chunks

Does anyone in the community have an idea on why this keeps on happening ?

2 Answers

In some docker configurations you just need to uncomment the line related to MMAP (SendFile is Off by default).

 sed -i 's|#EnableMMAP off|EnableMMAP off|' /etc/apache2/httpd.conf \

Also you can look at you httpd.conf in your apache container to be sure weither you need to add/uncomment this MMAP option to Off

I had a similar issue downloading static files in docker container from a volume mapped to a folder that’s mounted on its Linux host. i.e. a samba network drive mounted on Linux host, docker container running inside the Linux host, the folder passed to the container via -v parameter.

Downloading a text log file (using wget from a different machine or browser) may appear around 1.5MB contains around 20 times corrupted bytes (some missing bytes, some additional bytes from the same file, some may just be binary corrupt bytes). File size remain the same. Repeat download the same file and the corrupted bytes are different.

wget from the linux host seem getting the file identical to the original file.

I’m using the php:7.0-apache image which seems to have no EnableSendFile On/Off settings in any conf file. Turning on the EnableSendFile in a conf solved the issue. Files downloaded binary identical to the original file from the samba network drive.

I don’t know of why this solved the issue. Hope these information helps.

Related