Almost pulling my hair out trying to figure out docker watch

TLDR: docker compose --watch isn’t mounting the files/dirs first

this is one of my services:

  searxng:
    container_name: searxng
    image: docker.io/searxng/searxng:latest
    restart: unless-stopped
    networks:
      - searxng
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./searxng:/etc/searxng
      # - ./Pictures/banner.png:/usr/local/searxng/searx/static/themes/simple/img/searxng.png
      - ./simple-custom-fork:/usr/local/searxng/searx/static/themes/simple
      - searxng-data:/var/cache/searxng:rw
    environment:
      - SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
      - SEARXNG_SECRET=$SEARXNG_SECRET
    develop:
      watch:
        - action: sync+restart
          path: ./searxng
          target: /etc/searxng
        # - action: sync+restart 
        #   path: ./simple-custom-fork
        #   target: /usr/local/searxng/searx/static/themes/simple
        - action: restart
          path: ./docker-compose.yaml

i’m running the compose by doing docker compose up --watch

if i mount the ./simple-custom-fork dir using volumes:, it workes, however if i try to use the action and mount it that way, it doesn’t work

same thing happens for ./searxng btw, is this is a bug? should i open a bug report? or am i doing something wrong?

docker version:

❯ docker --version
Docker version 29.2.1, build a5c7197d72

docker related packages that i have installed on my system:

❯ paru -Qs docker
local/docker 1:29.2.1-1
    Pack, ship and run any application as a lightweight container
local/docker-buildx 0.31.0-1
    Docker CLI plugin for extended build capabilities with BuildKit
local/docker-compose 5.0.2-1
    Fast, isolated development environments using Docker

The documentation ()https://docs.docker.com/compose/how-tos/file-watch/ says

A common pattern is for initial content to be copied into the container using the COPY instruction in a Dockerfile

The actions will have effect only when something changes. There is also an initial_sync parameter. Quoting from the documentation

initial_sync

When using a sync+x action, the initial_sync attribute tells Compose to ensure files that are part of the defined path are up to date before starting a new watch session.

i just tried out initial_sync, isn’t really working

Than a COPY in a Dockerfile could help. That is what I am doing anyway. I think when I last tried initial_sync it was not even valid on my machine. This is how I started my watch session every time:

docker compose up --build --watch

I will try the sync paramter again when I find time.