Search code examples
docker-compose

docker compose watch, use different file than docker-compose.yml


Has anyone tried docker compose watch? I'm testing it but I need to launch a compose file that has a different name than docker-compose.yml, I tried with:

docker compose watch -f compose-custom.yml

but I get this error:

unknown shorthand flag: 'f' in -f


Solution

  • According to docker compose --help:

    Usage: docker compose [OPTIONS] COMMAND

    Define and run multi-container applications with Docker

    According to docker compose watch --help:

    Usage: docker compose watch [SERVICE...]

    Watch build context for service and rebuild/refresh containers when files are updated

    So you have to run:

    docker compose -f compose-custom.yml watch