Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache, PHP, WordPress caching issue in Docker container

I'm on OS X using the Virtualbox driver for docker. Using the official WordPress docker image, I setup a volume from my local machine to map to the container

/Users/gezimhome/projects/zr/src:/var/www/html/wp-content/plugins/zr

When I update files in the host, they show updated in the container but changes don't reflect on the website until a few minutes later. I suspect it might be Apache caching something as I don't have any WordPress caching plugins installed.

Update: I've not tried other types of files. The PHP files are not being updated when I load the site in the browser (or even using curl).

Update 2: Here's the .htaccess file. Here's the docker virtualbox info

like image 447
Gezim Avatar asked Feb 09 '16 01:02

Gezim


1 Answers

It turns out this was caused by opcache in PHP. Opcache was enabled in the wordpress docker image as follows:

RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=60'; \
        echo 'opcache.fast_shutdown=1'; \
        echo 'opcache.enable_cli=1'; \
    } > /usr/local/etc/php/conf.d/opcache-recommended.ini

So, I created a new docker image for wordpress that disables caching. It's essentially this:

FROM wordpress:latest
RUN rm -rf /usr/local/etc/php/conf.d/opcache-recommended.ini
like image 70
Gezim Avatar answered Oct 13 '22 20:10

Gezim