Open binaryfire opened 8 months ago
Why not use sync+restart
to replace your bind mount then?
watch
actually check there's no conflicting bind mount, which (use to) demonstrate a configuration mistake
We have a single image for local development that has Node/PHP/Python/etc. installed and doesn't contain any app data. We use that image + command:
to run multiple services in local development by bind-mounting /workdir
to different repositories. Many of these services are not containerized in production so Docker is only used in local development for these. Also, several repos are massive and contain huge files that change regularly - sync wouldn't be as performant.
We're quite happy with our setup. All of the recent communication from Docker has been about making the local development experience better. Shouldn't that include supporting how different teams work rather than trying to switch everyone from bind mounts to sync? I don't really understand the downside of adding a standalone restart
option. Is there a reason to avoid it other than trying to discourage the use of bind mounts?
My question is not to reject this feature request, but to better understand which use-cases this would cover, and the benefits for our users.
Ah ok, sorry. I misunderstood.
Hopefully my description explains our use case.
I agree with @binaryfire that this would be really helpful. I stumbled across the same issue a few weeks back and would really like to have an option where I can simply restart the command specified in the docker-compose.yml if a mounted file in a given directory changes.
I am currently using multiple docker images that run some Python scripts which are bind-mounted and the sync+restart takes quite some time which could be avoided that way
@ndeloof I also came to the idea that it would be nice to be able to restart containers.
We have this case:
Locally we use docker compose and bind the ~/.aws
folder to many containers.
Naturally, you can’t put this in a Dockerfile
.
But I would like to be able to restart containers if something has changed in the ~/.aws
folder
sync+restart do not work as expected with docker secrets because they are bound under the root user, but the process can be launched from another user (I haven’t found a way to bypass this)
Hi guys
We use bind mounts for local development, and there are still times when you need to restart the container on file changes. Laravel's queue workers are a good example - they need to be restarted to pick up on changes and there's no simple way to automate that without a package and some custom code.
Currently there's no Compose Watch action that covers this scenario.
sync+restart
expects a target that it can sync files to. Would it be possible to add a simplerestart
action that can just watch files at a given path and restart the container if anything changes? This would make our (and I'm sure many other people's) lives much easier. I'm assuming this would be pretty easy to add: the functionality is there, it's just currently always coupled to a sync?PS. This has been requested before here: https://github.com/docker/compose/issues/11062#issue-1923631209