[IDEA] docker compose up --watch
Description
I love the new watch feature !! Thanks !!!
However I feel it could be better integrated in the docker compose workflow.
From what I understand:
docker compose watchrunsdocker compose up --build -dbeforehanddocker compose watch --no-updoesn't start the stack at all so it can be started separately
The first is convenient, but lacks all the flexibility of docker compose up (optional --build, --remove-orphans, --force-recreate, --profiles, etc.).
The second provides all needed flexibility but requires two distinct commands as stated in #11157 (which was closed as doable with docker compose watch --no-up & docker compose up)
What about adding the --watch flag to docker compose up (and maybe deprecating/dropping the whole docker compose watch subcommand) ? Not sure about implementation, but from an user point of view it certainly would feel more natural.
I was about to post this idea too!
It's annoying that I have to build all images every time I do docker compose watch so I thought maybe it could have the same default functionality as docker compose up? This means, only build images if no images are already built, or force builds with --build.
We can have that and only modify the watch command, or as OP said, have docker compose up --watch which I suppose is the same as what I've described, just for the up command. Or both 🙃
Also, I would like to take the opportunity and ask mods to see https://github.com/docker/compose/issues/11098#issuecomment-1898452970 and hopefully reopen the issue!
+1
I would like to be able to auto-reload containers which use a volume mount, by defining watch rule in the compose file, preferably without running in a special mode
currently I get error "can't watch service "stepfunctions" without a build context" when trying to use it with the amazon/aws-stepfunctions-local mock tool which has a config file you need to pass in via volume path
it seems that it only works for containers that have a build directive? This isn't spelled out in the docs AFAICT
also it's a bit confusing how watch + action: sync relates to volumes... seems like a separate new way to share files into the container?
This seems to have been implemented now: https://github.com/docker/compose/pull/11525