Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recreate the container if a volume file changed #444

Open
bwaldvogel opened this issue Jun 25, 2024 · 1 comment
Open

Recreate the container if a volume file changed #444

bwaldvogel opened this issue Jun 25, 2024 · 1 comment

Comments

@bwaldvogel
Copy link
Contributor

I have a Docker Compose service that mounts some project files as volume into the container

services:
  my-service:
    
    volumes:
      - ./my-config1.yaml:/path/in/container/my-config1.yaml:ro
      - ./my-config2.yaml:/path/in/container/my-config2.yaml:ro

To the best of my knowledge, docker compose up my-service does not restart the container if it’s already up and running, even if my-config1.yaml or my-config2.yaml changed.

Since we are using Gradle with the gradle-docker-compose-plugin anyway, I would like to leverage Gradle to track input file changes and let trigger the Docker container recreation if necessary.

Is there a recommended way to achieve this or does even gradle-docker-compose-plugin support this feature out-of-the-box?

@augi
Copy link
Member

augi commented Aug 27, 2024

Hello, I think that you are referring to the reconnecting feature: https://github.com/avast/gradle-docker-compose-plugin?tab=readme-ov-file#reconnecting

The decision if the plugin should reconnect or call a new up is driven by the getStateForCache method

So maybe someone could prepare a PR that would improve this method to cover more things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants