A
A
alex5e2018-11-05 11:47:23
symfony
alex5e, 2018-11-05 11:47:23

How to properly disable directory sync in Docker?

I have a Symfony project hosted in a docker container

...
php:
        build:
            context: ./docker/php
        ports:
            - 9000:9000
        volumes:
            - ./:/srv/www/project
            - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
            - ./docker/php/php.ini:/usr/local/etc/php/php.ini
        environment:
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
...

Inside /srv/www/project there is a var directory where the cache and logs are located. With each request, the files are updated there and the overhead in the form of synchronization is rather robust and slows down the container.
Tell me how to make files from the var directory updated in the container, but not synchronized?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2018-11-05
@MadridianFox

I don't know for sure, but perhaps in Symfony you can somehow change the location of the var folder. Then you can take it out of volume and it will be inside the container. Although there are logs ... logs are convenient to have outside.
Adjusting volume so that part of it is... not volume.. is somehow unnatural. I think it's impossible.
And generally speaking. If this is a prod, then you need to rebuild the image with each release so that only data sticks out, and the code is part of the image.
If it's dev, then what's the problem? Let yourself slow down. By the way, if this is dev and you are working under windows and docker is running in a virtual machine, then the reason for the brakes may not be in the volume, but in the shared folder of the virtual machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question