The Docker Compose Cheatsheet

3. Volumes

Mounting volumes is essentially required but can cause insane performance issues. Therefore it is very important to configure them correctly to prevent bottlenecks. This issue affects mainly Docker for Mac and Docker for Windows as Linux hosts can mount paths “more natively” into the container.

With the following flags, docker can manage the sync interval between the filesystem, to increase the perfomance.

Now let’s check if the volume mounts were all configured correctly:

3.1 Flag: :delegated

The containers view is the truth. There can be a delay until changes are available to the host.
Useful for example the database

3.2 Flag: :cached

The host view is the truth. There can be a delay until changes are available to the container.
Useful for example the codebase

3.3 Flag: :consistent

Keep perfect sync

Leave a Reply

Your email address will not be published. Required fields are marked *