Description
I originally reported this issue in docker/compose, but was asked to report it instead. See the original report for a "compose" reproducer.
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.
Reproduce
$ docker run --mount type=image,src=alpine,dst=/etc/foo --mount type=image,src=alpine,dst=/etc/bar alpine ls -al /etc
docker: Error response from daemon: mount already exists with name
Expected behavior
I would expect that the image volume would be mounted.
docker version
Client: Docker Engine - Community
Version: 28.1.1
API version: 1.49
Go version: go1.23.8
Git commit: 4eba377
Built: Fri Apr 18 09:52:29 2025
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 28.1.1
API version: 1.49 (minimum version 1.24)
Go version: go1.23.8
Git commit: 01f442b
Built: Fri Apr 18 09:52:29 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
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
Additional Info
No response
Description
I originally reported this issue in docker/compose, but was asked to report it instead. See the original report for a "compose" reproducer.
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.
Reproduce
Expected behavior
I would expect that the image volume would be mounted.
docker version
Client: Docker Engine - Community Version: 28.1.1 API version: 1.49 Go version: go1.23.8 Git commit: 4eba377 Built: Fri Apr 18 09:52:29 2025 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 28.1.1 API version: 1.49 (minimum version 1.24) Go version: go1.23.8 Git commit: 01f442b Built: Fri Apr 18 09:52:29 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.27 GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da runc: Version: 1.2.5 GitCommit: v1.2.5-0-g59923ef docker-init: Version: 0.19.0 GitCommit: de40ad0docker info
Additional Info
No response