docker / docker/compose

Add optional auto-confirm label on volumes

Open
#13,807 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
38.2k
Forks
5.8k
Avg merge
2d 14h
Merged PRs (30d)
55

Description

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:
    driver: local
    driver_opts:
      device: tmpfs
      o: size=1k,uid=65530,gid=0,mode=0700,noexec
      type: tmpfs
    labels:
+      com.docker.compose.volume.recreate-when-spec-updated: "true"
      foo: bar
  nfs:
    driver: local
    driver_opts:
      type: nfs
      o: addr=XXX,nfsvers=4.2,soft,timeo=600,retrans=2,rsize=1048576,wsize=1048576
      device: :/storage2/sonarr/media/
    labels:
+      com.docker.compose.volume.recreate-when-spec-updated: "true"
  no_recreate_label:
    labels:
      foo: bar

use case
  1. Shared tmpfs mounts between services
  2. Volume mounts that can be safely deleted without removing the underlying data (e.g., NFS volumes)

https://github.com/kimdre/doco-cd/issues/1130 https://github.com/kimdre/doco-cd/issues/1267

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named; start by tracing the volume recreation confirmation path in the Go Compose code. Check how per-volume labels from the Compose file are read and where the confirmation decision is made. Done means the specified label enables non-interactive recreation for that volume while unlabeled volumes retain interactive behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
57/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.