Description
In CI/CD workflows, changes to volumes may trigger interactive confirmation prompts, which can break automation and require manual intervention.
For example, when an existing volume does not match the Compose specification, Docker may prompt:
Volume "... " exists but doesn't match the Compose specification in the Compose file. Recreate (data will be lost)?
To support non-interactive environments, it would be useful to provide an option to automatically confirm volume recreation in such cases, while keeping the default interactive behavior unchanged.
This behavior is controlled via a per-volume label, allowing precise control when multiple volumes are defined in a single Compose file. The label does not apply globally.
Example
services:
app:
image: alpine
volumes:
- my_vol:/my_vol
- no_recreate_label:/no_recreate_label
volumes:
my_vol:
labels:
com.docker.compose.volume.recreate-when-spec-updated: "true"
foo: bar
no_recreate_label:
labels:
foo: bar
use case kimdre/doco-cd#1130
Description
In CI/CD workflows, changes to volumes may trigger interactive confirmation prompts, which can break automation and require manual intervention.
For example, when an existing volume does not match the Compose specification, Docker may prompt:
Volume "... " exists but doesn't match the Compose specification in the Compose file. Recreate (data will be lost)?To support non-interactive environments, it would be useful to provide an option to automatically confirm volume recreation in such cases, while keeping the default interactive behavior unchanged.
This behavior is controlled via a per-volume label, allowing precise control when multiple volumes are defined in a single Compose file. The label does not apply globally.
Example
use case kimdre/doco-cd#1130