Docker is slow after adding volumes (Wordpress)

Viewed 2533

I would like to use Docker for local development. When I create a container with Wordpress using Docker Compose, everything loads very quickly in the browser. It's much faster than using Local by Flywheel. The problem is that I do not have access to Wordpress files. To access these files, I added volumes to docker-compose.yml:

volumes:
  - ./wp-content:/var/www/html/wp-content

I can access the files now, but everything loads so slowly in the browser that using Docker loses its meaning. Is it possible to speed it up in any way?

1 Answers

The problem is about "consistency type" in volume. Set it up as "cached"

services:
    wordpress:

        ...

        volumes:
            - ./data:/data
            - ./scripts:/docker-entrypoint-initwp.d
            #- ./wp-content:/app/wp-content
            - type: bind
              source: ./wp-content
              target: /app/wp-content
              consistency: cached
            #- ./php-conf:/usr/local/etc/php
            - type: bind
              source: ./php-conf
              target: /usr/local/etc/php
              consistency: cached

Here for more details

Related