v2.2.0: volume already exists but was not created by Docker Compose. Use `external: true` to use an existing volume'
Description
Starting a project in docker-compose v2.2.0/2.2.1 fails all the time with various messages like
volume "ddev-global-cache" already exists but was not created by Docker Compose. Use
external: trueto use an existing volume'
This is a simple ddev start and can be replicated on any project with docker-compose 2.2.1 (which seems to have already made its way to Arch Linux)
Steps to reproduce the issue:
Use this docker-compose file:
services:
ddev-router:
container_name: ddev-router
environment:
DISABLE_HTTP2: "false"
healthcheck:
timeout: 2m0s
interval: 1s
retries: 120
start_period: 2m0s
image: drud/ddev-router:v1.18.0
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 443
published: 443
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 80
published: 80
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 8025
published: 8025
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 8026
published: 8026
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 8036
published: 8036
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 8037
published: 8037
protocol: tcp
restart: "no"
volumes:
- type: bind
source: /var/run/docker.sock
target: /tmp/docker.sock
read_only: true
bind:
create_host_path: true
- type: volume
source: ddev-global-cache
target: /mnt/ddev-global-cache
volume: {}
networks:
default:
name: ddev_default
external: true
volumes:
ddev-global-cache:
name: ddev-global-cache
You'll get
volume "ddev-global-cache" already exists but was not created by Docker Compose. Use
external: trueto use an existing volume
Describe the results you received:
See above
Describe the results you expected:
docker-compose has worked with this type of file through all versions until 2.2.1.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker compose version:
2.2.1
Output of docker info:
docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
WARNING: Plugin "/home/parallels/.docker/cli-plugins/docker-compose-2.0.1" is not valid: plugin candidate "compose-2.0.1" did not match "^[a-z][a-z0-9]*$"
WARNING: Plugin "/home/parallels/.docker/cli-plugins/docker-compose-2.1.1" is not valid: plugin candidate "compose-2.1.1" did not match "^[a-z][a-z0-9]*$"
WARNING: Plugin "/home/parallels/.docker/cli-plugins/docker-compose-2.2.0" is not valid: plugin candidate "compose-2.2.0" did not match "^[a-z][a-z0-9]*$"
WARNING: Plugin "/home/parallels/.docker/cli-plugins/docker-compose-2.2.1" is not valid: plugin candidate "compose-2.2.1" did not match "^[a-z][a-z0-9]*$"
Server:
Containers: 10
Running: 1
Paused: 0
Stopped: 9
Images: 44
Server Version: 20.10.11
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-66-generic
Operating System: Ubuntu 20.04.3 LTS
OSType: linux
Architecture: aarch64
CPUs: 2
Total Memory: 1.934GiB
Name: ubuntu-linux-20-04-desktop
ID: IHLF:K6KY:DXXR:RCTK:IRUY:S5M6:4ZWL:RRQP:FHCO:N6ZR:GURE:YTFG
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional environment details:
I'm seeing this as a arch user who just updated, anyway to get latest 2.1.1 set as the active package for arch?
I'm seeing this as a arch user who just updated, anyway to get latest
2.1.1set as the active package for arch?
# pacman -U /var/cache/pacman/pkg/docker-compose-2.1.1-1-x86_64.pkg.tar.zst
I'm seeing this as a arch user who just updated, anyway to get latest
2.1.1set as the active package for arch?# pacman -U /var/cache/pacman/pkg/docker-compose-2.1.1-1-x86_64.pkg.tar.zst
Thanks
try version 2.0.1 instead. 2.1.0 did not work for me either.
Hi, I have a use case which I have to manually create and mount some files into a volume before docker compose up command creating it and don't want to see the warning message.
I'm wondering if it's a valid request to not show the warning message if the volume is created manually ?