sajad torkamani

Consider this docker-compose.yml file:

version: '3'

services:
  acme_api:
    build: .
    container_name: acme-api
    ports:
      - "8080:80"
    volumes:
      - ./app:/code/app:delegated

What does the ./app:/code/app:delegated section mean?

The :delegated bit is a flag that you can use to tell Docker how to manage the volume. There are three available flags:

  • consistent (default): The container’s view of the volume is exactly the same as the host at all times.
  • delegated: The container’s filesystem takes precedence. If there is a change to the volume from within the container, there might be a slight delay before the host’s view of the volume is updated. This can provide better performance for write-heavy workloads where the container will be frequently updating the filesystem.
  • cached: Docker caches the host’s filesystem for the mounted volume. When processes from containers read a file from the mounted volume, they’re often reading from the cache, especially if the file was recently accessed.
Tagged: Docker

Leave a comment

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