问题
System Setup:
- Docker Version 1.9.1, build a34a1d5
- Oracle VirtualBox 4.3.34r104062
- Image: https://hub.docker.com/r/rc42/flaskserver/
When I edit the CSS file in my flask server <link rel="stylesheet" href="{{ url_for('static', filename='styles/bootstrap.css') }}">
, the following things seem to happen:
- The changes do not show up when I reload the localhost test page.
- The changes do not show up when I remove/rerun the container.
- The changes do not show up when I stop/restart the container.
At first, I thought it might be a web browser cache problem, but it is not. I have tested this problem against a hard reload, different browsers and all manner of browser cache clearing. On top of this, when I enter the container and examine the file, none of the changes show up in a 'cat' or 'grep' call. But, all examinations of the file on my own system show the changes have indeed occurred on the file.
The only way that I can seem to get these changes to propagate is if I refactor the file name to a name I have not previously used for the css file. <link rel="stylesheet" href="{{ url_for('static', filename='styles/bootstrap1.css') }}">
But, if I refactor the name back to the original name, the old version of the file once again shows up in my cat commands and file requests.
PROBLEM: VIRTUALBOX MEMORY
I do not know exactly what is happening, but this seems to be some caching problem with VirtualBox. On a hunch, I "Reset" the boot2docker image in Virtualbox and the latest changes that I made to the file prior to the reset propagated.
But, there does not appear to be any way to adjust Virtualbox to prevent this caching problem from occurring. "Use Host I/O Cache" toggle is permanently set to ON in the Settings > Storage for the image.
Perhaps the guys at Docker can look into this. It sounds like there is some memory management problem that isn't just isolated to my case. A similar problem has also been documented recently here by someone performing web app edits through Virtualbox. And, it doesn't seem to be very useful for editing to have to reset Virtualbox every time I make a style change.
来源:https://stackoverflow.com/questions/35691388/docker-error-css-file-in-mapped-volume-fails-to-update