8

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

8
  • specifically what kind of files Commented Feb 9, 2016 at 1:44
  • Thanks for asking. PHP files. Commented Feb 9, 2016 at 1:44
  • Are there any issues with your port mappings? Have you checked your .htaccess file for any weird headers? Commented Feb 9, 2016 at 1:51
  • Also what's the config on the docker container in question? Have you allocated resources correctly? Enough RAM / CPU? Commented Feb 9, 2016 at 1:56
  • Updated with more info, @MatthewRath. Commented Feb 9, 2016 at 2:16

1 Answer 1

20

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
Sign up to request clarification or add additional context in comments.

4 Comments

Nice find. You can also simply map a blank file over that one like: -v ./blankopcache/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini
Thanks for this! Caching is not great while developing and there's nothing about the stack the official image uses online.
Wow that's awesome. This was driving me nuts.
You could also just add php_flag opcache.enable Off to your WordPress .htaccess, which disables the opcode caching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.