-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Description
Description
Mounting an image volume multiple time with the same source image doesn't seem to work as expected. (error: "mount already exists with name").
I would expect that the image volume would be mounted.
Changing the image source to using the digest corresponding to the tag instead of a tag seems to work around the problem.
For context, my use case is that I need to mount a directory but still prevent the shadowing of a few files from the same directory in the image.
Steps To Reproduce
With the following compose.yaml, running
docker compose up mount_bugtriggers the bug, while
docker compose up mount_okdoesn't.
# Minimal reproducer for multiple image mount bug
#
# $ docker compose up mount_bug
# [+] Running 0/1
# ⠋ Container compose-bug-mount_bug-1 Creating 0.0s
# Error response from daemon: mount already exists with name
#
#
# $ docker compose up mount_ok
# [+] Running 2/2
# ✔ Container compose-bug-mount_ok-1 Created 0.0s
# ! mount_ok Image mount is an experimental feature 0.0s
# Attaching to mount_ok-1
# mount_ok-1 | openssl.cnf
# mount_ok-1 | openssl.cnf.dist
# mount_ok-1 exited with code 0
services:
mount_bug:
image: alpine:3.21.3
tmpfs:
- /etc/ssl:mode=1755,uid=0,gid=0
volumes:
- type: image
source: alpine:3.21.3
read_only: true
target: /etc/ssl/openssl.cnf
image:
subpath: etc/ssl/openssl.cnf
- type: image
source: alpine:3.21.3
read_only: true
target: /etc/ssl/openssl.cnf.dist
image:
subpath: etc/ssl/openssl.cnf.dist
entrypoint: ls /etc/ssl
mount_ok:
image: alpine:3.21.3
tmpfs:
- /etc/ssl:mode=1755,uid=0,gid=0
volumes:
- type: image
source: "alpine@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c" # 3.21.3
read_only: true
target: /etc/ssl/openssl.cnf
image:
subpath: etc/ssl/openssl.cnf
- type: image
source: alpine:3.21.3
read_only: true
target: /etc/ssl/openssl.cnf.dist
image:
subpath: etc/ssl/openssl.cnf.dist
entrypoint: ls /etc/sslCompose Version
Docker Compose version v2.35.1
Docker Environment
Client: Docker Engine - Community
Version: 28.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.35.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 70
Server Version: 28.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.10.0-35-amd64
Operating System: Debian GNU/Linux 11 (bullseye)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.759GiB
Name: alchemy
ID: fbfb1d0b-9b94-4be2-9720-20850fe255d0
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http://172.16.0.1:3128
HTTPS Proxy: http://172.16.0.1:3128
No Proxy: localhost,127.0.0.1
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Anything else?
No response
Reactions are currently unavailable