Home Ask Login Register

Developers Planet

Your answer is one click away!

Gezim February 2016

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


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


Gezim February 2016

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

Post Status

Asked in February 2016
Viewed 3,148 times
Voted 5
Answered 1 times


Leave an answer

Quote of the day: live life