Skip to main content

MacOS - Improving docker volume performance (for Symfony4 development e.g.)

Category: PHP
php-logo

Docker volumes are operating painfully slow on macOS by default. Loading a bare Symfony App Controller may take up to 12s. Here I gonna provide a short list of tweaks for performance improvement.

1. Volumes should use raw-format

docker disk settings

The raw-format has been disabled for macOS High Sierra due to issues with the Apple Filesystem. Docker Community Edition 18.05.0-ce-rc1-mac63 (Edge) brought back the raw format support. Switching to raw format can be done by resetting to factory defaults in docker settings. 

2. Use cached volumes

    php:
        build:
            context: php7-fpm
            args:
                TIMEZONE: ${TIMEZONE}
        volumes:
            - ${SYMFONY_APP_PATH}:/var/www/symfony:cached

The usage of the :cached option for volumes in docker-compose.yml brought a huge performance boot.

Results

docker loading time